-
Notifications
You must be signed in to change notification settings - Fork 71
Database.PostgreSQL.Simple.Internal.exec: resource vanished (failed to fetch file descriptor) #168
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
Comments
Well, typically it means that the connection vanished, without receiving an error message from the database backend. Any time you go over anything more than loopback, and especially a wide-area network, you probably need to write your logger to be tolerant to network hiccups leading to a loss of connection (and thus potentially also lost notifications that were sent while your logger was away, if that's important).
I'd also check your server's logs for any messages, if you can. And, if this is happening consistently, then running a packet capture on the client and/or server can be very enlightening. (And wireshark has a postgresql protocol dissector, so I highly recommend using wireshark for analyzing the capture after the fact.) |
Hello, Currently my code does some error checks (as shown in my previous message), but there was no Also, haskell application did exit immediately after this error, which is something I want to avoid. |
Here is my
PostgreSQL server is 9.3.9 |
Well, what I'm saying is (if necessary) turn on logging on the postgresql server side of things, and check the error logs there too. This particular exception is an |
Also, while it's certainly a worthy goal to write a daemon that never crashes, in practice you probably still want to have a supervisor process that will detect when a daemon crashes and restarts it automatically. There are a number of options, but both upstart and systemd can natively handle simple single-process supervision like this. |
Thanks, very helpful suggestions. May be this discussion would be interesting and put some light on the problem. |
Well, I didn't read the whole thread carefully, but I don't think we have any evidence that the current issue is related to the psycopg one that you linked, and perhaps a bit of evidence that it's not. But I do find this to be a slightly curious event over loopback connections. So:
This will capture all loopback packets that have a source or destination port of |
Also, in many distributions, SSL will by default be used in a situation like this; so if you do a packet capture, you may want to include |
Hello
|
News out there: it crashed again with the same error.
I set up tcpdump traffic logging and will publish results after next crash. |
Regarding the postgresql restart, that's not surprising. Were you expecting something different? The first message I suspect is a notice being printed by libpq. New enough versions of I have a little utility program that throws that particular exception on a regular basis for slightly different reasons: the program replicates and merges some event tables in near real time, and is connected via a VPN over a the public internet to a site fairly far away in real terms. This connection is somewhat flaky, so whenever the connection disappears, and the operating system finally decides the connection is gone and informs that program, then libpq does it's thing and informs my program by not returning a file descriptor, which causes this error to be raised. |
Hello,
This issue was already discussed: #117
The conclusion was that it is due to some websocket related code which used pg socket and sent unexpected by PostgreSQL server ping packets.
I have quite simple Haskell program which just listen to messages and calls plpgsql procedure on each message. No websocket or any other additional socket related code.
After about 30 hours of work it died with
Database.PostgreSQL.Simple.Internal.exec: resource vanished (failed to fetch file descriptor)
Any idea what may be a reason for the error and how to prevent it ?
The text was updated successfully, but these errors were encountered: