ConnectionError EADDRINUSE ESOCKET on large insert

285 views
Skip to first unread message

Gerhard Sletten

unread,
Sep 25, 2014, 7:49:26 PM9/25/14
to node-t...@googlegroups.com
Hi, I am doing a greater amount of data insert via Stored Procedure on a database at database.windows.net from a NodeJS appliactioin running on Azure and after about 200-300 inserts I get theese errors:

{ [ConnectionError: Failed to connect to zj8i8n25gv.database.windows.net:1433 - connect EADDRINUSE]
  name
: 'ConnectionError',
  message
: 'Failed to connect to zj8i8n25gv.database.windows.net:1433 - connect EADDRINUSE',
  code
: 'ESOCKET' }

Typically when I run about 400 calls to a stored procedure to insert some data, about 100 of them will fail with this error.
When I run the application on my local computer it seems that I get fewer errors, sometimes none or only a few will fail.
  • Is this problem connected to running it on the Azure cloud? (Is there a fixed set of ports/sockets/connections available)
  • Or is this problem on Microsofts cloud database at database.windows.net?
  • Should I try to distribute thoose inserts over a greater time period, by "baking" Stored Procedures Inserts into a Promise and only running a few at the time, and trigger the next batch-insert after the previous as been done. Is there some best practice on how many insert/calles you can do in one batch?

Mike Pilsbury

unread,
Sep 28, 2014, 5:33:19 AM9/28/14
to node-t...@googlegroups.com
Are you making each stored procedure call with a new connection to the database? That sounds terribly inefficient.

In any case you're more likely to get help if you raise this as an issue on github, as I'm not sure that any of the active developers monitor this group. 

--
You received this message because you are subscribed to the Google Groups "tedious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-tedious...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gerhard Sletten

unread,
Oct 1, 2014, 6:48:11 AM10/1/14
to node-t...@googlegroups.com
Hi Mike

Thanks. The reason I postet here, was that I was a little unsure whether is is a bug in Tedious, limitations in the Azure node envirioment or how my use of it.

Yes, I am creating a connetion for every procedure, when I startet out I was trying to reuse the connection, but when I did that with multiple async calls a got some errors, and in the documentations it says:

Only one request at a time may be executed on a connection.

so I changed it so that they use their own connection. 
  • But should Tedious be able to run multiple parallel calls on the same database?
  • Or should I rather distribute the calls one at the time?

Gerhard Sletten

unread,
Oct 1, 2014, 6:50:53 AM10/1/14
to node-t...@googlegroups.com
Update:

  • But should Tedious be able to run multiple parallel calls on the same database? (it you use a separate connection for each parallel call)
  • Or should I rather distribute the calls one at the time?

Nick Stuckey

unread,
Oct 10, 2014, 10:47:38 AM10/10/14
to node-t...@googlegroups.com
Gerhard,


Yes, you will have to use multiple connections to do so though.

I'm currently using Tedious Connection Pool to run multiple queries in parallel since it does a good job of managing the connections. I haven't run any deep tests yet, but I believe it also holds open the connection for a period of time so that it can be reused without the overhead of opening a new connection.

gerhardsletten

unread,
Oct 14, 2014, 5:24:41 AM10/14/14
to node-t...@googlegroups.com
Hi Nick

Thanks, then I will try it out!


You received this message because you are subscribed to a topic in the Google Groups "tedious" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-tedious/zBZe90wdi9I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-tedious...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages