question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Portal does not exists when reading from stream

See original GitHub issue

Hi,

I am using the rxjava implementation (1.3x) and I am facing an error I cannot explain. Scenario : a few million rows in a PgTable.

The following code:

pool.rxGetConnection().flatMapObservable { conn ->
            conn.rxPrepare("SELECT suggestion FROM suggestions WHERE suggestion != keyword AND country = \$1")
                .doOnEach { _ -> println("Prepare on ${Thread.currentThread().getName()}") }
                .flatMapObservable { preparedQuery -> preparedQuery
                    .createStream(10, Tuple.of(country))
                    .toObservable()
                    .doOnCompleted {
                    println("Find suggestions completed on ${Thread.currentThread().getName()}")
                    preparedQuery.close()
                    conn.close()
                }
            }
        }
                                .doOnNext { println("row.getString On ${Thread.currentThread().getName()}") }
                                .map { row -> row.getString("suggestion") }

I get the first 10 results (which makes sense since I have a fetch size of 10 and then I get this error that seems that we are having a cursor issue, somewhere.

io.reactiverse.pgclient.PgException: portal "caeea323-3d74-4af3-bd76-5b3dfb6d7811" does not exist
        at io.reactiverse.pgclient.impl.QueryCommandBase.handleErrorResponse(QueryCommandBase.java:68)
        at io.reactiverse.pgclient.impl.codec.decoder.MessageDecoder.decodeError(MessageDecoder.java:250)
3
        at io.reactiverse.pgclient.impl.codec.decoder.MessageDecoder.decodeMessage(MessageDecoder.java:139)
        at io.reactiverse.pgclient.impl.codec.decoder.MessageDecoder.channelRead(MessageDecoder.java:119)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1359)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:935)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:141)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)

The documentation says that I should be in a Transaction since cursors requires that. I tried to conn.begin() and tx.commit() when I am in doOnCompleted but I end up blocking since the stream doesn’t start.

any idea?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vietjcommented, Jul 3, 2018

I think that we should prevent creating a cursor when there is no transaction.

For instance the Cursor API could be only available on the transaction API to enforce this.

0reactions
kiddoukcommented, Jul 3, 2018

I have been working on isolating why my approach doesn’t work and reading the tests and the javadoc, it is clear that I am at fault here.

In order to benefit from the cursor, I shall create a Transaction. A simple conn.rxQuery("BEGIN").flatMapObservable({ _ -> conn.prepareQuerx.... }) does the trick.

Note that previously, I had done a conn.begin() in order to create a TX but that seems to block the thread and never return anything.

Now that I have something that works, we need to decide if the code shall be patched to create a BEGIN automagically or if we should simply do a doc update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft Stream (Classic) playback errors
List of Stream (Classic) playback errors with explanations. ... This video isn't available, Either the video does not exist or the video has...
Read more >
The specified blob does not exist - Shows in azure browser
I believe its an issue with the portal. If you notice, the name of your blob is: Tommy French Toals.North Street.1250251 and it...
Read more >
Troubleshooting Streaming - Oracle Help Center
This error is related to the client. The Streaming service doesn't send it, which means that the request never made it to the...
Read more >
Troubleshooting Amazon Kinesis Data Firehose
If the data source is a Kinesis data stream, Kinesis Data Firehose retries ... Check the following if data is not delivered to...
Read more >
JsonParserReader.Entry (IBM WebSphere Portal Version 8.5.0.0 ...
The stream representation of the entry will close the entry but not the complete stream. Depending on the type of the entry, the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found