New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible bug in driver #23
Comments
It looks like the server closed the connection. Is it happening reliably? Is there a specific query that triggers it? |
Yes it happens every time. And I can't even catch exception. Full code with the queries: |
Can you strip out everything, and reduce the code to: opening the connection, sending the queries (fixed ones by hand)? Looking at a method without context, or what the queries are doesn't do much... |
I am trying to do it already several days. The single queries work (at last on my PC) but on real project (on big DB) I am getting fail. |
If you are running the same queries, that suggests a network connection issue could be happening with the real project. |
But DB and dart app is on same server. And I am getting an error approximately at same time. Why catch do not handle nothing? |
Sorry, I can't help you with the current information: I don't know nothing about your environment, setup, vpn, network policies etc. You'll need to create a much simpler reproduction code, otherwise I'm not able to try and debug it locally. |
One thing I noticed when looking at the code was: postgresql-dart/lib/src/query.dart Line 42 in d2197c9
There are lot of potential nasty issues by using the sync-version of My suspicion is that the error flow have not been fully tested and verified that the sync |
@isoos julemand101 was right! it's bug. I removed
(I am happy with it :) ) |
@julemand101: great finding, I'll fix that soon... |
Unfortunately many tests failed when I move it to async completer, so I've reverted the change for now. I'll need to dig into why the test fails, but I'm not sure if I'll have the time for it in the coming days. If anybody feels up for it, I'm happy to review and accept PRs changing this, as long as tests keep passing.. |
@isoos Yeah, I did not expect the solution would be the one I suggested since I can spot multiple places in the code base where the intention is how events are handled. I have not made any detailed analysis of it so I cannot say for sure if this is needed. But I did get this feeling that some of the code base is specifically designed for the use of sync postgresql-dart/lib/src/connection_fsm.dart Lines 345 to 350 in a9ea00e
I don't know the history of this project and if this is some important attempt to solve performance issues. But it kinda smell like an attempt to improve performance where it is not needed (we are going to have IO wait time anyway since we are talking to an external database, so I don't really see a major benefit of preventing the spawn of one event per query). I don't know if I am going to spend any time trying to get a better understanding of this package and fix this issue (especially since I don't even use PostgressSQL). But I might end up doing it if my weekend end up being boring enough. 🦆 |
@isoos oh... PostgreSQL is really pain. Fix above (remove sync call) is break your pool code. After fix above the follow code stopped to work with message that second insert failed:
|
You don't need to call that, if you are using @julemand101: yeah, there are low-level parts in the code that pre-date my involvement and I have no insight on what the intention was. However, in this case, it seems that making the completer async screws up the order of the state transitions, and we've got duplicate rows in the result set - it makes tests fail. So before doing this fix with the On the plus side, I think the code has the potential to work just fine with the sync Completer, and we should be able to access the underlying issues. However, I really need a better reproduction case (/cc @bubnenkoff). E.g. I've added a few tests in #24 using a local postgres through docker, and you could probably follow the same pattern to create a code that reproduces your issue. I'll take over from there... |
@isoos the reproduction is hard. I even was not able to reproduce it on on my local machine, only on working server... |
Hello. I can't handle exception on next code
https://stackoverflow.com/questions/70692397/cant-catch-exception-getting-unhandled-exception
Can it be bug in driver?
The text was updated successfully, but these errors were encountered: