Coder Social home page Coder Social logo

Important: Unresolved query promise about mysql HOT 9 CLOSED

brstgt avatar brstgt commented on August 18, 2024
Important: Unresolved query promise

from mysql.

Comments (9)

brstgt avatar brstgt commented on August 18, 2024

Maybe also related: Isn't there a way to detect when a connection is lost and to remove these stale connections from the pool? I think that was the case in 0.2.x. At least I did not have to retry the query multiple times in some cases but I MUST do that with 0.3.1

from mysql.

brstgt avatar brstgt commented on August 18, 2024

I just recognized: It has nothing to do with the gone server. It also happens if I remove the yield new Delayed()

from mysql.

bwoebi avatar bwoebi commented on August 18, 2024

I believe there is some old TODO with this... Well, looks like we finally have to look into this again properly.

from mysql.

brstgt avatar brstgt commented on August 18, 2024

Insight: It happens if not all column-defs are received in the first read. Wasn't able to debug further yet. Gotta go now. Thanks!

from mysql.

brstgt avatar brstgt commented on August 18, 2024

I am not sure whats the intention of the read barrier in processor::read but I think that's the cause. ::handlequery resolves the deferred that is added by ::query. If the first read chunk does not contain the whole result, handlequery resolves the deferred but more data is needed. The read loop runs into the read barrier as ::$deferred is empty. But ::$waiting will never be resolved. Actually this can even cause the loop to stop as the read watcher is disabled and no writes are pending.
I also think that's the problem why stale connections aren't detected as the socket is only read when there is a pending ::$deferred. I think that's not quite correct and this was different in 0.2.x which worked well wrt to this issues

from mysql.

brstgt avatar brstgt commented on August 18, 2024

Is that read barrier really required? MySQL should only send data when there was a request before anyway, right? And if we have a read without a corresponding Task this should be considered a state or protocol error?!

from mysql.

trowski avatar trowski commented on August 18, 2024

The purpose of the read barrier was to prevent an idle connection having a busy watcher in the loop, so that the object would be automatically destroyed and the loop stop. The place where the barrier was created and released was wrong however, so the connection was closed prematurely. I believe I fixed the locations, and I also just used the ref/unref API on socket instead of a promise. Please try the current master and let me know if that fixes the issue.

from mysql.

brstgt avatar brstgt commented on August 18, 2024

from mysql.

brstgt avatar brstgt commented on August 18, 2024

Seems to work, dude :) You made my day! Thanks!

from mysql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.