Coder Social home page Coder Social logo

Comments (5)

jackc avatar jackc commented on June 1, 2024

I added working code in the commit 251d54d to branch lost-conn. I haven't merged it in yet as I'm not sure how I feel about it. On the plus side, it should definitely work. Keep-alive and Exec'ing a nop in the WaitForNotification loop did not detect lost connections (in a reasonable amount of time) on my linux workstation when physically pulling the network cable. This goes back to the previous discussion about TCP keep-alive being highly variable across platforms. This new approach uses read deadlines and should behave correctly and consistently across platforms.

It works as is, but I'm curious if what is really needed is package wide lost connection / timeout management. Because it is still possible in Query/Exec to block until keep-alive finally did its thing. I'm not sure exactly what that would look like, so maybe this should just be merged in for the time being. It doesn't expose any public methods/values so it can be changed freely later...

from pgx.

jackc avatar jackc commented on June 1, 2024

Oh, I also updated https://github.com/jackc/pgx_notify_lost_connection to use this new version and it does show it working.

from pgx.

flowchartsman avatar flowchartsman commented on June 1, 2024

What are your concerns about this code?

from pgx.

jackc avatar jackc commented on June 1, 2024

No functional concerns, just wasn't sure how it felt stylistically. Wasn't sure if I liked having to adjust the SetReadDeadline in the middle like that. I'll probably merge it in a day or two, just wanted to let it sit a little and come back later with fresh eyes.

from pgx.

jackc avatar jackc commented on June 1, 2024

Rebased and merged in 5edd660.

from pgx.

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.