Code Monkey home page Code Monkey logo

Comments (3)

steve-chavez avatar steve-chavez commented on July 18, 2024

This might be another issue. But I've noticed that hasql-notification is ignoring an error. Check:

void $ PQ.consumeInput pqCon

https://github.com/diogob/hasql-notifications/blob/master/src/Hasql/Notifications.hs#L175

And the pg docs say:

PQconsumeInput normally returns 1 indicating โ€œno errorโ€, but returns 0 if there was some kind of trouble (in which case PQerrorMessage can be consulted).

Edit: Reported this on diogob/hasql-notifications#20.

from postgrest.

steve-chavez avatar steve-chavez commented on July 18, 2024

FATAL: terminating connection due to administrator command
Maybe there's a die (prints to stderr) somewhere in our code or hasql-notifications.

I think the above doesn't come from hasql-notifications but rather from hasql-pool.

from postgrest.

laurenceisla avatar laurenceisla commented on July 18, 2024

It looks like it comes from the LibPQ library.

It can be traced first in the hasql-notifications code. I used Debug.Trace to check exactly where this happened:

import Debug.Trace (traceIO)
-- ...
waitForNotifications sendNotification con =
  withLibPQConnection con $ void . forever . pqFetch
  where
    pqFetch pqCon = do
      traceIO "Before notifies"
      mNotification <- PQ.notifies pqCon
      traceIO "After notifies"
-- ...

Then, after executing the pg_terminate_backend command, the logs start with:

Before notifies
FATAL:  terminating connection due to administrator command
After notifies

Which leads to the postgresql-libpq code:

-- ...
notifies connection =
    withConn connection $ \ptr ->
           traceIO "Before PQnotifies"
           mn <- c_PQnotifies ptr
           traceIO "After PQnotifies"
-- ...

And it logs:

Before PQnotifies
FATAL:  terminating connection due to administrator command
After PQnotifies

So maybe somewhere in the PQnotifies function of the LibPQ library, it logs this error?

Some notes:

  • It does return an error message that could be used, although it does it after the FATAL: ... log.
  • Not sure if the FATAL:.. log can be stopped/modified at the hasql-notifications or postgresql-libpq libraries.

from postgrest.

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.