-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
This socket has been ended by the other party #725
Comments
Did you get this figured out? I need a larger code sample to tell you On Mon, Feb 9, 2015 at 7:13 PM, Gady [email protected] wrote:
|
Hey @brianc I'm observing this as well about 50% of the time I attempt to roll back a transaction. Here's the stack trace I'm seeing. Running
Here's that DBConnection class - planning on open sourcing it soon as a thing you could point to re: transactions if you wish. https://gist.github.com/kevinburkeshyp/edadef3bd85b6dd0dddf Let me know if I can provide any more debugging information - I haven't dug into this at all. |
The new relic stuff is unfortunate but I'm not sure I can tear it out. |
(Probably the next thing you will ask me to do is set up a reproducible test case and unfortunately this will take more time. I will try my best but it may take a while.) |
I had an idea! @brianc I am wondering what happens if you are in a transaction and you try a DB write that fails a check constraint. I believe that automatically aborts the transaction in most scenarios... maybe there's a race between the transaction aborting/pgbouncer killing the connection, and the client issuing a rollback request? |
We are using node-postgres (PostgreSQL client for node.js) to connect Redshift from lambda function. The connection to Redshift works properly for 80% of times, but fails randomly. The error message we got was, 2015-09-30T04:53:57.259Z 1d9361fc-672f-11e5-a760-31ab2e36abea Error: This socket has been ended by the other party at Socket.writeAfterFIN as write at Connection.query (/var/task/node_modules/pg/lib/connection.js:189:15) at Query.submit (/var/task/node_modules/pg/lib/query.js:115:16) at Client._pulseQueryQueue (/var/task/node_modules/pg/lib/client.js:298:24) at Client.query (/var/task/node_modules/pg/lib/client.js:326:8) at /var/task/index.js:98:20 at null. (/var/task/node_modules/pg/lib/client.js:184:7) at g (events.js:180:16) at emit (events.js:92:17) at Socket. (/var/task/node_modules/pg/lib/connection.js:66:10) We are using multiple/parallel connections to Redhsift from Lambda functions. Let us know if you have some ideas about this issue |
@iamvp I don't have any ideas off the top of my head, but I'm happy to discuss deeper via email. [email protected] |
any news? |
I'm receiving this error after each insert:
Means, first time i'm inserting it fine, but when i'm attempting to do insert another data, or retrieve data etc -i'm getting this error.
|
I am also facing similar errors almost 50% of the times - while connecting to redshift from AWS lambda.
|
I'm getting this too. I'm on OSX, and I think it's related to #122 Edit: Okay, this consistently fails about 30 seconds after the first connection is made. Have a feeling there's a timeout somewhere. |
I'm having this problem too! Any help would be greatly appreciated! ✋ |
@tuckerconnelly the Wiki example you have linked to does not actually solve the problem... As for using |
I'm not too familiar with the lower-level node server stuff, but I'd take a look at the req object, and if the browser is requesting twice. I also don't see how that's related lol. You could use a higher-order function to pass it around. const myMiddleware = require('myMiddleware');
app.use(myMiddleware(pg)) koa has a context ( |
I think I've found a repro steps. Looks like the error happens in the following sequence, but when you skip fails: pg.connect -> client1.query -> client1.end -> pg.connect -> client2.query repro sample: var run = function(sql, cb) {
pg.connect("postgres://postgres:pwd@localhost/test", function (err, client, done) {
if (err)
return console.error('could not connect to postgres', err);
client.query(sql, function (err, result) {
done();
client.end(function(){
if (err)
return cb('error running query. ' + err);
else
return cb(null, result);
});
});
});
};
var sql = 'select 1';
run(sql, function(err, result) {
console.log('1', err || 'OK');
//output: 1 OK
run(sql, function(err, result) {
console.log('2', err || 'OK');
//output: error running query. Error: This socket has been ended by the other party
});
}); the error happens on second |
I was having the same issue, but after removing this:
this error did not occur anymore. From the README.md, if I am understanding it correctly, it seems that when calling |
@acucciniello yeap this makes perfect sense, however it should not matter, because after |
As acucciniello said, when using Creating pools explicitly with the |
I'm not using
|
Hey people, I just went to But then I got into "too many clients already" error :( |
Why is this happening? I connect my server to db with pg.connect, and execute few queries with the client given, and after every query, i call done(). What's wrong?
at Socket.writeAfterFIN as write
at Connection.query (/node_modules/pg/lib/connection.js:189:15)
at Query.submit (/node_modules/pg/lib/query.js:106:16)
at Client._pulseQueryQueue (/node_modules/pg/lib/client.js:293:24)
at Client.query (/node_modules/pg/lib/client.js:321:8)
The text was updated successfully, but these errors were encountered: