Error: write ECONNABORTED
at afterWriteDispatched (internal/stream_base_commons.js:75:25)
at writeGeneric (internal/stream_base_commons.js:70:3)
at Socket._writeGeneric (net.js:760:5)
at Socket._write (net.js:772:8)
at doWrite (_stream_writable.js:410:12)
at clearBuffer (_stream_writable.js:540:7)
at Socket.Writable.uncork (_stream_writable.js:314:7)
at ServerResponse.end (_http_outgoing.js:733:21)
at respond (E:WebstormProjectstestnode_moduleskoalibapplication.js:243:7)
at handleResponse (E:WebstormProjectstestnode_moduleskoalibapplication.js:149:34)
at process._tickCallback (internal/process/next_tick.js:68:7)
my code:
const Koa =require("koa")
const app =new Koa();
app.use(ctx=>ctx.body={name:"hello world"});
app.listen(4000)
if i run autocannon -c 100 -d 5 -p 10 http://127.0.0.1:4000/
will error
I tried what you suggested, however this is the error I received instead:
Error: write EPIPE
at _errnoException (util.js:992:11)
at WriteWrap.afterWrite [as oncomplete] (net.js:864:14)
I tried reducing the pipelining on autocannon (down to 2) which resulted in no errors.
Then I tried fiddling with my OS’s limit on open files and it seemed that the higher I had it the more pipelined requests I could use, without getting an error. For example by setting it as high as I could (4096) it was possible for me to increase the pipelining to 3 without error.
Perhaps this means it’s an OS issue? Does changing your limit on open files have any affect on the problem?
if i use http.createServer()
this problem would not exist
@hxkuc do you mean with Koa (app.callback()
) or just a plain node http server?
I can reproduce this on a macOS Hight Sierra (early 2018).
node 8.11.x and 10.7.x
npm 6.2.0 and 6.1.0
koa.js
'use strict' const Koa = require("koa") const app = new Koa() app.use(ctx => { ctx.body = { name: 'hello world' } }) app.listen(4000) // Error: write EPIPE // at _errnoException (util.js:1022:11) // at WriteWrap.afterWrite [as oncomplete] (net.js:880:14)
http
'use strict' const http = require('http') const app = http.createServer((request, response) => { // Replicate Koa behaviour response.writeHead(200, JSON.stringify({ hello: 'hello world' })) response.end() }) app.listen(4000)
running auto cannon for both:
$ npx autocannon -c 100 -d 10 -p 5 http://127.0.0.1:4000/
As @theteapot and @hxkuc mentioned, a plain http server results in no errors for same load. I’ve actually hit this in production but deduced it as client error previously.
this is the full stack trace from an inspect
Error: write EPIPE
at WriteWrap.afterWrite [as oncomplete] (net.js:836:14)
| onerror | @ | application.js:195
| emit | @ | events.js:182
| onerror | @ | context.js:117
| onerror | @ | application.js:147
| listener | @ | index.js:169
| onFinish | @ | index.js:100
| callback | @ | index.js:55
| onevent | @ | index.js:93
| emit | @ | events.js:187
| onwriteError | @ | _stream_writable.js:431
| onwrite | @ | _stream_writable.js:456
| _destroy | @ | destroy.js:40
| Socket._destroy | @ | net.js:606
| destroy | @ | destroy.js:32
| afterWrite | @ | net.js:838
| WRITEWRAP (async) | |
| init | @ | inspector_async_hook.js:27
| emitInitNative | @ | async_hooks.js:137
| writevGeneric | @ | stream_base_commons.js:59
| Socket._writeGeneric | @ | net.js:759
| Socket._writev | @ | net.js:768
| doWrite | @ | _stream_writable.js:408
| clearBuffer | @ | _stream_writable.js:517
| Writable.uncork | @ | _stream_writable.js:314
| _flushOutput | @ | _http_outgoing.js:804
| _flush | @ | _http_outgoing.js:779
| assignSocket | @ | _http_server.js:179
| resOnFinish | @ | _http_server.js:583
| emit | @ | events.js:187
| onFinish | @ | _http_outgoing.js:681
| _tickCallback | @ | next_tick.js:61
| TickObject (async) | |
| init | @ | inspector_async_hook.js:27
| emitInitNative | @ | async_hooks.js:137
| emitInitScript | @ | async_hooks.js:336
| TickObject | @ | next_tick.js:86
| nextTick | @ | next_tick.js:117
| defaultTriggerAsyncIdScope | @ | async_hooks.js:294
| _writeRaw | @ | _http_outgoing.js:264
| _send | @ | _http_outgoing.js:235
| end | @ | _http_outgoing.js:727
| respond | @ | application.js:248
| handleResponse | @ | application.js:148
| _tickCallback | @ | next_tick.js:68
| Promise.then (async) | |
| handleRequest | @ | application.js:150
| handleRequest | @ | application.js:132
| emit | @ | events.js:182
| parserOnIncoming | @ | _http_server.js:658
| parserOnHeadersComplete | @ | _http_common.js:109
@fl0w yeah it’s a serious bug
Actually, I retract what I previously wrote. This occurs using a plain http server as well, Koa is just better by not swallowing the error. The following example outputs the same error:
'use strict' const http = require('http') const app = http.createServer((request, response) => { response.writeHead(200, JSON.stringify({ hello: 'hello world' })) response.end() }) app.on('clientError', (err, socket) => { throw err }) app.listen(4000) // Error: write EPIPE // at WriteWrap.afterWrite [as oncomplete] (net.js:836:14) // { Error: write EPIPE at WriteWrap.afterWrite [as oncomplete] (net.js:836:14) errno: 'EPIPE', code: 'EPIPE', syscall: 'write' }
$ npx autocannon -c 100 -d 10 -p 10 http://127.0.0.1:4000/
Not sure why this is happening other than it hitting an OS limit for a sys write call.
i will take this question to nodejs repositories
Increasing maxfiles on macOS from 256 to 262144 didn’t reduce N errors.
I wouldn’t, this could easily be an autocannon issue. I can’t reproduce the error using ab.
you mean it’s a bug of autocannon?
No, I’m saying i wouldn’t automatically assume it’s a node lib bug, could just be a client error (what I’ve previously deduced these errors to in production).
Thanks a lot. Let me try it again
I’m going to close this as according to my investigation this isn’t a Koa issue. Please feel free to re-open if your findings shows otherwise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 |
const TelegramBot = require('node-telegram-bot-api'); const token = 'k'; const fs = require('fs'); const bot = new TelegramBot(token, {polling: true}); bot.on('text', function(msg) { var messageChatId = msg.chat.id; var messageText = msg.text; console.log(msg); if (messageText === 'Задать вопрос') { bot.sendMessage(msg.chat.id, "Вопросы",questions); } if (messageText === '/start') { var opts = { reply_markup: JSON.stringify({ keyboard: [ ['Официальный сайт','Отзывы партнеров'], ['Получить презентацию','Карта точек продаж'] ] }) }; bot.sendMessage(msg.chat.id, "Добрый день " + msg.from.first_name + "!" , opts); bot.sendMessage(msg.chat.id, "Я бот интернет-магазина ", { reply_markup: { inline_keyboard: keyboard } }); } if (messageText === 'Официальный сайт') { bot.sendMessage(messageChatId, '/',{ reply_markup: { inline_keyboard: back_menu } }); } if (messageText === 'Отзывы партнеров') { bot.sendMessage(messageChatId, 'Отзывы партнеров',reviews,); } if (messageText === 'Получить презентацию') { bot.sendMessage(messageChatId, 'Выбирете презентацию:',{ reply_markup: { inline_keyboard: download } }); } if (messageText === 'Карта точек продаж') { bot.sendMessage(messageChatId, 'Наши магазины по всей России:', list_of_cities); } }); const keyboard = [ [ { text: 'Задать вопрос', callback_data: 'help_one' }, ], [ { text: 'Получить скидку', callback_data: 'help_two' } ], ]; const download = [ [ { text: 'Презентация по франшизе', callback_data: 'download_one' }, ], [ { text: 'Франшиза перезагрузка', callback_data: 'download_two' } ], [ { text: 'Назад', callback_data: 'back_menu' } ], ]; const cancal = [ [ { text: 'Еще вопросы', callback_data: 'help_one' }, ] ]; const download_back = [ [ { text: 'Назад', callback_data: 'download_back' }, ] ]; const back_menu = [ [ { text: 'Назад', callback_data: 'back_menu' }, ] ]; const keyboard_questions = [ [ { text: 'Как Вы боретесь с воровством?', callback_data: 'question_1' }, ], [ { text: 'Сколько человек работает в магазине?', callback_data: 'question_2' } ], [ { text: 'Где лучше открыть магазин?', callback_data: 'question_3' } ], [ { text: 'Какой график работы магазина?', callback_data: 'question_4' } ], [ { text: 'От чего зависит цена франшизы?', callback_data: 'question_5' } ], [ { text: 'Кто нанимает продавцов?', callback_data: 'question_6' } ], [ { text: 'Есть ли обучение?', callback_data: 'question_7' } ], [ { text: 'Есть ли доставка товаров?', callback_data: 'question_8' }, ], [ { text: 'Какие бренды входят в товарную матрицу?', callback_data: 'question_9' } ], [ { text: 'Что после открытия?', callback_data: 'question_10' } ], [ { text: 'Роялти что это такое, сколько, и зачем?', callback_data: 'question_11' } ], [ { text: 'Можно площадь магазина больше?', callback_data: 'question_12' } ], [ { text: 'Возможна самостоятельная закупка оборудования?', callback_data: 'question_13' } ], [ { text: 'Смогу конкурировать с другими?', callback_data: 'question_14' } ], [ { text: 'Есть всего один миллион бюджета, сможем открыть?', callback_data: 'question_15' } ], [ { text: 'Назад', callback_data: 'back' } ], ]; bot.on('callback_query', (query) => { const chatId = query.message.chat.id; if (query.data === 'help_one') { bot.sendMessage(chatId, "Задать вопрос", { reply_markup: { inline_keyboard: keyboard_questions } }); } if (query.data === 'help_two') { bot.sendMessage(chatId, 'https://t.me/', { reply_markup: { inline_keyboard: back_menu } }); } if (query.data === 'back_menu') { bot.sendMessage(chatId, "Я бот интернет-магазина ", { reply_markup: { inline_keyboard: keyboard } }); } if (query.data === 'download_one') { bot.sendDocument(chatId, "Презентация по франшизе.pdf", { reply_markup: { inline_keyboard: download_back } }); } if (query.data === 'download_two') { bot.sendDocument(chatId, "Франшиза перезагрузка.pdf", { reply_markup: { inline_keyboard: download_back } }); } if (query.data === 'download_back') { bot.sendMessage(chatId, 'Выбирите презентацию', { reply_markup: { inline_keyboard: download } }); } if (query.data === 'question_1') { bot.sendMessage(chatId, "Защитные магниты, защитные боксы, система видеонаблюдения.n По нашим расчётам стоимость системы защиты и антивор стоит дороже, чем затраты на воровство.", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_2') { bot.sendMessage(chatId, "Штат от 3 человек, один из которых заведующий.", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_3') { bot.sendMessage(chatId, "В городе с населением от 20 тыс. человек. После заключения договора мы поможем Вам с подбором помещения и выберем оптимально подходящий вариант. ", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_4') { bot.sendMessage(chatId, "Рабочее время индивидуально для каждого. Наши магазины работают ежедневно. ", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_5') { bot.sendMessage(chatId, "Ценовой эквалайзер гибкий и зависит от площади объекта, так же от количества и разнообразия выбора товаров в розничном магазине.", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_6') { bot.sendMessage(chatId, "Нанимает франчайзинг. Наша компания помогает с подбором персонала. И далее дает руководство по методике найма.", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_7') { bot.sendMessage(chatId, "Обучение обязательная программа франшизы. Есть курсы онлайн и офлайн встречи с управляющими из нашей сети и сети партнеров. ", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_8') { bot.sendMessage(chatId, "Доставка осуществляется разными способами в зависимости от региона. У нашей компании, на сегодняшний день, достаточно отлаженный процесс. Груз отправляем в Омск, Екатеринбург, Лабытнанги, Иркутск.", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_9') { bot.sendMessage(chatId, "Мы мульти брендовая компания, которая на постоянной основе тестирует матрицу в собственной розничной сети и далее предлагает партнером уже проверенную потребительскую корзину. В матрице все наиболее известные бренды на рынке электротехники: ТДМ, ABB, Legrand, Schneider, Wolta, Rexant, Промрукав, DKS.", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_10') { bot.sendMessage(chatId, "При выборе пакета «Франшиза» Управляющая компания берет на себя обязательства по сопровождению розничного магазина. На постоянной основе проверки объекта по чек листу, помощь в составлении маркетингового плана развития. Рекомендации по товарной матрице магазина", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_11') { bot.sendMessage(chatId, "Ро́ялти — вид лицензионного вознаграждения, периодическая компенсация, как правило, денежная, за использование патентов, авторских прав, франшиз и других видов собственности. Размер роялти зависит от пакета услуг по дальнейшему сопровождению. В данном случае выгодная позиция для франчайзи, т.к. управляющая компания на прямую заинтересована в наилучшем успехе партнера. ", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_12') { bot.sendMessage(chatId, "Формат магазина от 100 м2 является стартовым и может быть рассмотрен и с большей площадью. Необходимо учесть и сумму инвестиций при увеличении площади объекта. ", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_13') { bot.sendMessage(chatId, "Мы предоставляем право партнеру на самостоятельную закупку оборудования, согласно разработанной спецификации проекта. ", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_14') { bot.sendMessage(chatId, "Конкурировать возможно всегда. Перед согласованием места аренды, проводится маркетинговое исследование региона, на предмет сложности входа в рынок. Производится адаптация по ценообразованию на продукцию. В случае согласования региона и открытия магазина, Ваш магазин сможет конкурировать свободно. ", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'question_15') { bot.sendMessage(chatId, "Минимальный объем инвестиции 4 млн. рублей. Рассмотрите возможность дополнительных инвестиций от партнёра или привлечение кредитных средств для развития малого и среднего предпринимательства. ", { reply_markup: { inline_keyboard: cancal } }); } if (query.data === 'back') { bot.sendMessage(chatId, "Я бот интернет-магазина ЭлектроМаркет", { reply_markup: { inline_keyboard: keyboard } }); } }); var list_of_cities = { reply_markup: JSON.stringify({ inline_keyboard: [ [{ text: 'Все точки продаж', url: 'https://*******/maps/' }], [{text: 'Назад',callback_data: 'back'}] ] }) }; var reviews = { reply_markup: JSON.stringify({ inline_keyboard: [ [{ text: 'Омск', url: 'https://t.me/' }], [{ text: 'Лабытнанги', url: 'https://t.me/' }], [{ text: 'Нижний Новогород', url: 'https://' }], [{ text: 'Сергиев Посад', url: 'https://' }], [{ text: 'Рыбинск', url: 'https://' }], [{ text: 'Назад',callback_data: 'back'}] ] }) }; |
Moderator: Project members
-
sov_sunday
- 500 Command not understood
- Posts: 3
- Joined: 2008-09-24 14:09
- First name: Ayilaran
- Last name: Sunday
ECONNABORTED — Connection aborted». what can I do
#1
Post
by sov_sunday » 2008-09-24 14:22
I have been trying to connect to the server but the message am getting is
Status: Connection attempt failed with «ECONNABORTED — Connection aborted».
Error: Could not connect to server
Someone should help me out for better services please.
-
boco
- Contributor
- Posts: 26451
- Joined: 2006-05-01 03:28
- Location: Germany
Re: ECONNABORTED — Connection aborted». what can I do
#2
Post
by boco » 2008-09-24 21:25
Using Filezilla Server? If not, wrong forum. Please respond, I will move this topic to the correct one, then.
### BEGIN SIGNATURE BLOCK ###
No support requests per PM! You will NOT get any reply!!!
FTP connection problems? Do yourself a favor and read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
### END SIGNATURE BLOCK ###
-
sov_sunday
- 500 Command not understood
- Posts: 3
- Joined: 2008-09-24 14:09
- First name: Ayilaran
- Last name: Sunday
Re: ECONNABORTED — Connection aborted». what can I do
#3
Post
by sov_sunday » 2008-10-02 17:59
Yes::: Am talking about FileZilla Server Client… Since all this while I can’t upload any file from my PC.
The message am getting is………
Status: Connection attempt failed with «ECONNABORTED — Connection aborted».
Error: Could not connect to server
Pls do help.
Thanks
-
boco
- Contributor
- Posts: 26451
- Joined: 2006-05-01 03:28
- Location: Germany
Re: ECONNABORTED — Connection aborted». what can I do
#4
Post
by boco » 2008-10-02 20:42
sov_sunday wrote:Am talking about FileZilla Server Client…
Filezilla Server or Filezilla Client? Or both?
Your client seems to be blocked by a firewall or some other pseudo-security-solution. Is this really only on upload? The initial login is successfully? If yes, I’d love to see a log, please.
### BEGIN SIGNATURE BLOCK ###
No support requests per PM! You will NOT get any reply!!!
FTP connection problems? Do yourself a favor and read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
### END SIGNATURE BLOCK ###
-
sov_sunday
- 500 Command not understood
- Posts: 3
- Joined: 2008-09-24 14:09
- First name: Ayilaran
- Last name: Sunday
Re: ECONNABORTED — Connection aborted». what can I do
#5
Post
by sov_sunday » 2008-10-03 08:36
FileZilla Client and this happen when am trying to login to connect to the server, I’ll get something like …….
Status: Resolving address of www……
Status: Connecting to …….
Status: Connection attempt failed with «ECONNABORTED — Connection aborted».
Error: Could not connect to server
Status: Waiting to retry…
Status: Resolving address of www…..
Status: Connecting to ……………
Status: Connection attempt failed with «ECONNABORTED — Connection aborted».
Error: Could not connect to server
Status: Waiting to retry…
Status: Resolving address of www……………..
Status: Connecting to ……………..
Status: Connection attempt failed with «ECONNABORTED — Connection aborted».
Error: Could not connect to server
The initial login is NOT successfully while I try to login. Am using this FileZilla Client fine before but since last few week I could’nt be able to login.
Pls do help.
Thanks.
-
boco
- Contributor
- Posts: 26451
- Joined: 2006-05-01 03:28
- Location: Germany
Re: ECONNABORTED — Connection aborted». what can I do
#6
Post
by boco » 2008-10-03 16:21
Did you check your firewall already? On update of Filezilla, it’s executable is replaced, effectively changing it’s checksum. Many firewalls and security software block applications with changed checksums, as it could indicate a malware infection. In this case you need to re-allow Filezilla in these software(s).
And did you try another server like ftp://ftp.debian.org ?
### BEGIN SIGNATURE BLOCK ###
No support requests per PM! You will NOT get any reply!!!
FTP connection problems? Do yourself a favor and read Network Configuration.
FileZilla connection test: https://filezilla-project.org/conntest.php
### END SIGNATURE BLOCK ###
-
mart4494
- 500 Command not understood
- Posts: 5
- Joined: 2008-10-04 08:48
- First name: Mart
- Last name: Brom
Re: ECONNABORTED — Connection aborted». what can I do
#7
Post
by mart4494 » 2008-10-04 08:55
Hi All — had exactly the same problem getting onto a FTPS as being described yesterday — using 3.1.3.1 — tried everything. Then as a last resort tried an old copy of FileZilla 2.2.26a and the thing connected first time perfectly. So obviously something has changed somewhere in the basics between 2 and 3. But for anyone having this problem you may like to try with v2 of FileZilla — it worked for me.
-
mart4494
- 500 Command not understood
- Posts: 5
- Joined: 2008-10-04 08:48
- First name: Mart
- Last name: Brom
Re: ECONNABORTED — Connection aborted». what can I do
#8
Post
by mart4494 » 2008-10-04 09:00
Apologies — here was the message being received using FileZilla 3
Status: Resolving address of ftp.xxxxx.xxx
Status: Connecting to xx.xxx.xxx.xxx:xx…
Status: Connection established, waiting for welcome message…
Response: 220 xxxxx Secure FTP Server
Command: AUTH TLS
Response: 234 AUTH Command OK. Initializing SSL connection.
Status: Initializing TLS…
Status: Verifying certificate…
Command: USER xxxxxx_xxxxxx
Status: TLS/SSL connection established.
Response: 331 Password required for xxxxxx_xxxxxx.
Command: PASS **********
Response: 230 Login OK. Proceed.
Command: PBSZ 0
Response: 200 PBSZ Command OK. Protection buffer size set to 0.
Command: PROT P
Response: 200 PROT Command OK. Using Private data connection
Status: Connected
Status: Retrieving directory listing…
Command: PWD
Response: 257 «/xxx/xxxxxx_xxxxxx» is current folder.
Command: TYPE I
Response: 200 Type set to I.
Command: PASV
Response: 227 Entering Passive Mode (xx,xxx,xxx,xxx,xx,xx).
Command: LIST
Response: 150 Opening ASCII mode data connection for file list.
Response: 226 Transfer complete. 218 bytes transferred. 218 Bps.
Status: Server did not properly shut down TLS connection
Error: Transfer connection interrupted: ECONNABORTED — Connection aborted
Error: Failed to retrieve directory listing
All sorted using v2 of FileZilla
-
botg
- Site Admin
- Posts: 34744
- Joined: 2004-02-23 20:49
- First name: Tim
- Last name: Kosse
- Contact:
Re: ECONNABORTED — Connection aborted». what can I do
#9
Post
by botg » 2008-10-04 10:51
Your server is broken. You need to upgrade to a fixed/better server.
-
mart4494
- 500 Command not understood
- Posts: 5
- Joined: 2008-10-04 08:48
- First name: Mart
- Last name: Brom
Re: ECONNABORTED — Connection aborted». what can I do
#10
Post
by mart4494 » 2008-10-04 11:20
Hi Site Admin — not sure if your response was directed at myself but if the server was broken or needs upgrading I’m confused as to why everything worked with v2 and not v3. The settings were as given to myself by the other party — so confusion rules supreme here. Anyway, I’ll use v2 for downloading these files via their FTPS as all is working okay with that version.
-
botg
- Site Admin
- Posts: 34744
- Joined: 2004-02-23 20:49
- First name: Tim
- Last name: Kosse
- Contact:
Re: ECONNABORTED — Connection aborted». what can I do
#11
Post
by botg » 2008-10-04 12:04
-
gath
- 500 Command not understood
- Posts: 2
- Joined: 2008-11-10 10:11
- First name: Gath
- Last name: Gath
Re: ECONNABORTED — Connection aborted». what can I do
#12
Post
by gath » 2008-11-10 10:18
Hi, I’m getting the ECONNABORTED failure, but I confused what is the cause. Because it only happens from one computer.
On computer/network A, I’ve tried connecting to my FTP Server (FileZilla 0.9.28beta) and then I get the ECONNABORTED failure. I get this failure from both the newest FileZilla client and also from another FTP client. I can however connect to other FTP Servers other then FileZilla. So it seems to be something with the FileZilla server.
But on another computer/network I can connect to this same server without problems…!
Following is the debug log from the FileZilla client when I run it from the computer/network where the failure comes.
Please somebody help, I love FileZilla have been using both the server and client forever without problems, but this is a really serious problem for me because I need to get it to work on this computer… :-/
Thanks, Gath
Debug Log:
Status: Resolving address of xxx.xxx.com
Status: Connecting to 72.3.xxx.xx:21…
Status: Connection established, waiting for welcome message…
Trace: CFtpControlSocket::OnReceive()
Response: 220-FileZilla Server version 0.9.28 beta
Trace: CFtpControlSocket::OnReceive()
Response: 220-written by Tim Kosse (Tim.Kosse@gmx.de)
Response: 220 Please visit http://sourceforge.net/projects/filezilla/
Trace: CFtpControlSocket::SendNextCommand()
Command: USER xxx
Trace: CFtpControlSocket::OnReceive()
Response: 331 Password required for xxx
Trace: CFtpControlSocket::SendNextCommand()
Command: PASS ***********
Trace: CFtpControlSocket::OnReceive()
Response: 230 Logged on
Trace: CFtpControlSocket::SendNextCommand()
Command: SYST
Trace: CFtpControlSocket::OnReceive()
Response: 215 UNIX emulated by FileZilla
Trace: CFtpControlSocket::SendNextCommand()
Command: FEAT
Trace: CFtpControlSocket::OnReceive()
Response: 211-Features:
Trace: CFtpControlSocket::OnReceive()
Response: MDTM
Response: REST STREAM
Response: SIZE
Response: MLST type*;size*;modify*;
Response: MLSD
Response: UTF8
Response: CLNT
Response: MFMT
Response: 211 End
Status: Connected
Trace: CFtpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Status: Retrieving directory listing…
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::ChangeDirSend()
Command: PWD
Trace: CFtpControlSocket::OnReceive()
Response: 257 «/» is current directory.
Trace: CFtpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Trace: CFtpControlSocket::ParseSubcommandResult(0)
Trace: CFtpControlSocket::ListSubcommandResult()
Trace: state = 1
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Trace: state = 1
Command: TYPE I
Trace: CFtpControlSocket::OnReceive()
Response: 200 Type set to I
Trace: CFtpControlSocket::TransferParseResponse()
Trace: code = 2
Trace: state = 1
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Trace: state = 2
Command: PASV
Trace: CRealControlSocket::OnClose(10053)
Error: Disconnected from server: ECONNABORTED — Connection aborted
Trace: CFtpControlSocket::ResetOperation(66)
Trace: CControlSocket::ResetOperation(66)
Trace: CFtpControlSocket::ResetOperation(66)
Trace: CControlSocket::ResetOperation(66)
Error: Failed to retrieve directory listing
-
mart4494
- 500 Command not understood
- Posts: 5
- Joined: 2008-10-04 08:48
- First name: Mart
- Last name: Brom
Re: ECONNABORTED — Connection aborted». what can I do
#13
Post
by mart4494 » 2008-11-10 10:25
Hi Gath
I went back to V2.2.26 which works just fine. It is something to do with V3 and I believe it is a security thing — not sure though so stand to be corrected. Followed all the posts that I could find on this one and didn’t feel like telling a couple of clients their servers were bust — don’t think they’d appreciate that.
-
gath
- 500 Command not understood
- Posts: 2
- Joined: 2008-11-10 10:11
- First name: Gath
- Last name: Gath
Re: ECONNABORTED — Connection aborted». what can I do
#14
Post
by gath » 2008-11-10 10:36
mart4494
Thanks for the answer. My problem is that it’s the other ftp client which doesn’t work with the server either and I cannot change that ftp-client which my customer uses (it’s part of another program). So I would need to change the FileZilla server to something else which I’m not so keen to do since it has served me so well.
And this same ftp-client which is failing on the specificed computer/network works fine when run from other computers, that’s what I don’t understand, so it’s not just the FileZilla server, but some combination of computer/network + server….
Best regards, Gath
-
mart4494
- 500 Command not understood
- Posts: 5
- Joined: 2008-10-04 08:48
- First name: Mart
- Last name: Brom
Re: ECONNABORTED — Connection aborted». what can I do
#15
Post
by mart4494 » 2008-11-10 11:37
Hi Garth
May not be relevant so a shot in the dark. I installed a new router (some time ago) my end and the thing was failing to connect. Then I disabled the XP firewall and left the router one operating — it was a hey presto moment. Everything suddenly worked and it was the XP firewall that was stopping everything with my setup anyway.
As I say a short in the dark. Good luck.
You will encounter various kinds of errors while developing Node.js
applications, but most can be avoided or easily mitigated with the right coding
practices. However, most of the information to fix these problems are currently
scattered across various GitHub issues and forum posts which could lead to
spending more time than necessary when seeking solutions.
Therefore, we’ve compiled this list of 15 common Node.js errors along with one
or more strategies to follow to fix each one. While this is not a comprehensive
list of all the errors you can encounter when developing Node.js applications,
it should help you understand why some of these common errors occur and feasible
solutions to avoid future recurrence.
🔭 Want to centralize and monitor your Node.js error logs?
Head over to Logtail and start ingesting your logs in 5 minutes.
1. ECONNRESET
ECONNRESET
is a common exception that occurs when the TCP connection to
another server is closed abruptly, usually before a response is received. It can
be emitted when you attempt a request through a TCP connection that has already
been closed or when the connection is closed before a response is received
(perhaps in case of a timeout). This exception will usually
look like the following depending on your version of Node.js:
Output
Error: socket hang up
at connResetException (node:internal/errors:691:14)
at Socket.socketOnEnd (node:_http_client:466:23)
at Socket.emit (node:events:532:35)
at endReadableNT (node:internal/streams/readable:1346:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ECONNRESET'
}
If this exception occurs when making a request to another server, you should
catch it and decide how to handle it. For example, you can retry the request
immediately, or queue it for later. You can also investigate your timeout
settings if you’d like to wait longer for the request to be
completed.
On the other hand, if it is caused by a client deliberately closing an
unfulfilled request to your server, then you don’t need to do anything except
end the connection (res.end()
), and stop any operations performed in
generating a response. You can detect if a client socket was destroyed through
the following:
app.get("/", (req, res) => {
// listen for the 'close' event on the request
req.on("close", () => {
console.log("closed connection");
});
console.log(res.socket.destroyed); // true if socket is closed
});
2. ENOTFOUND
The ENOTFOUND
exception occurs in Node.js when a connection cannot be
established to some host due to a DNS error. This usually occurs due to an
incorrect host
value, or when localhost
is not mapped correctly to
127.0.0.1
. It can also occur when a domain goes down or no longer exists.
Here’s an example of how the error often appears in the Node.js console:
Output
Error: getaddrinfo ENOTFOUND http://localhost
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'http://localhost'
}
If you get this error in your Node.js application or while running a script, you
can try the following strategies to fix it:
Check the domain name
First, ensure that you didn’t make a typo while entering the domain name. You
can also use a tool like DNS Checker to confirm that
the domain is resolving successfully in your location or region.
Check the host value
If you’re using http.request()
or https.request()
methods from the standard
library, ensure that the host
value in the options object contains only the
domain name or IP address of the server. It shouldn’t contain the protocol,
port, or request path (use the protocol
, port
, and path
properties for
those values respectively).
// don't do this
const options = {
host: 'http://example.com/path/to/resource',
};
// do this instead
const options = {
host: 'example.com',
path: '/path/to/resource',
};
http.request(options, (res) => {});
Check your localhost mapping
If you’re trying to connect to localhost
, and the ENOTFOUND
error is thrown,
it may mean that the localhost
is missing in your hosts file. On Linux and
macOS, ensure that your /etc/hosts
file contains the following entry:
You may need to flush your DNS cache afterward:
sudo killall -HUP mDNSResponder # macOS
On Linux, clearing the DNS cache depends on the distribution and caching service
in use. Therefore, do investigate the appropriate command to run on your system.
3. ETIMEDOUT
The ETIMEDOUT
error is thrown by the Node.js runtime when a connection or HTTP
request is not closed properly after some time. You might encounter this error
from time to time if you configured a timeout on your
outgoing HTTP requests. The general solution to this issue is to catch the error
and repeat the request, preferably using an
exponential backoff
strategy so that a waiting period is added between subsequent retries until the
request eventually succeeds, or the maximum amount of retries is reached. If you
encounter this error frequently, try to investigate your request timeout
settings and choose a more appropriate value for the endpoint
if possible.
4. ECONNREFUSED
The ECONNREFUSED
error is produced when a request is made to an endpoint but a
connection could not be established because the specified address wasn’t
reachable. This is usually caused by an inactive target service. For example,
the error below resulted from attempting to connect to http://localhost:8000
when no program is listening at that endpoint.
Error: connect ECONNREFUSED 127.0.0.1:8000
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)
Emitted 'error' event on ClientRequest instance at:
at Socket.socketErrorListener (node:_http_client:442:9)
at Socket.emit (node:events:526:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 8000
}
The fix for this problem is to ensure that the target service is active and
accepting connections at the specified endpoint.
5. ERRADDRINUSE
This error is commonly encountered when starting or restarting a web server. It
indicates that the server is attempting to listen for connections at a port that
is already occupied by some other application.
Error: listen EADDRINUSE: address already in use :::3001
at Server.setupListenHandle [as _listen2] (node:net:1330:16)
at listenInCluster (node:net:1378:12)
at Server.listen (node:net:1465:7)
at Function.listen (/home/ayo/dev/demo/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/home/ayo/dev/demo/main.js:16:18)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1357:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 3001
}
The easiest fix for this error would be to configure your application to listen
on a different port (preferably by updating an environmental variable). However,
if you need that specific port that is in use, you can find out the process ID
of the application using it through the command below:
Output
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 2902 ayo 19u IPv6 781904 0t0 TCP *:3001 (LISTEN)
Afterward, kill the process by passing the PID
value to the kill
command:
After running the command above, the application will be forcefully closed
freeing up the desired port for your intended use.
6. EADDRNOTAVAIL
This error is similar to EADDRINUSE
because it results from trying to run a
Node.js server at a specific port. It usually indicates a configuration issue
with your IP address, such as when you try to bind your server to a static IP:
const express = require('express');
const app = express();
const server = app.listen(3000, '192.168.0.101', function () {
console.log('server listening at port 3000......');
});
Output
Error: listen EADDRNOTAVAIL: address not available 192.168.0.101:3000
at Server.setupListenHandle [as _listen2] (node:net:1313:21)
at listenInCluster (node:net:1378:12)
at doListen (node:net:1516:7)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1357:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EADDRNOTAVAIL',
errno: -99,
syscall: 'listen',
address: '192.168.0.101',
port: 3000
}
To resolve this issue, ensure that you have the right IP address (it may
sometimes change), or you can bind to any or all IPs by using 0.0.0.0
as shown
below:
var server = app.listen(3000, '0.0.0.0', function () {
console.log('server listening at port 3000......');
});
7. ECONNABORTED
The ECONNABORTED
exception is thrown when an active network connection is
aborted by the server before reading from the request body or writing to the
response body has completed. The example below demonstrates how this problem can
occur in a Node.js program:
const express = require('express');
const app = express();
const path = require('path');
app.get('/', function (req, res, next) {
res.sendFile(path.join(__dirname, 'new.txt'), null, (err) => {
console.log(err);
});
res.end();
});
const server = app.listen(3000, () => {
console.log('server listening at port 3001......');
});
Output
Error: Request aborted
at onaborted (/home/ayo/dev/demo/node_modules/express/lib/response.js:1030:15)
at Immediate._onImmediate (/home/ayo/dev/demo/node_modules/express/lib/response.js:1072:9)
at processImmediate (node:internal/timers:466:21) {
code: 'ECONNABORTED'
}
The problem here is that res.end()
was called prematurely before
res.sendFile()
has had a chance to complete due to the asynchronous nature of
the method. The solution here is to move res.end()
into sendFile()
‘s
callback function:
app.get('/', function (req, res, next) {
res.sendFile(path.join(__dirname, 'new.txt'), null, (err) => {
console.log(err);
res.end();
});
});
8. EHOSTUNREACH
An EHOSTUNREACH
exception indicates that a TCP connection failed because the
underlying protocol software found no route to the network or host. It can also
be triggered when traffic is blocked by a firewall or in response to information
received by intermediate gateways or switching nodes. If you encounter this
error, you may need to check your operating system’s routing tables or firewall
setup to fix the problem.
9. EAI_AGAIN
Node.js throws an EAI_AGAIN
error when a temporary failure in domain name
resolution occurs. A DNS lookup timeout that usually indicates a problem with
your network connection or your proxy settings. You can get this error when
trying to install an npm
package:
Output
npm ERR! code EAI_AGAIN
npm ERR! syscall getaddrinfo
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/nestjs failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
If you’ve determined that your internet connection is working correctly, then
you should investigate your DNS resolver settings (/etc/resolv.conf
) or your
/etc/hosts
file to ensure it is set up correctly.
10. ENOENT
This error is a straightforward one. It means «Error No Entity» and is raised
when a specified path (file or directory) does not exist in the filesystem. It
is most commonly encountered when performing an operation with the fs
module
or running a script that expects a specific directory structure.
fs.open('non-existent-file.txt', (err, fd) => {
if (err) {
console.log(err);
}
});
Output
[Error: ENOENT: no such file or directory, open 'non-existent-file.txt'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'non-existent-file.txt'
}
To fix this error, you either need to create the expected directory structure or
change the path so that the script looks in the correct directory.
11. EISDIR
If you encounter this error, the operation that raised it expected a file
argument but was provided with a directory.
// config is actually a directory
fs.readFile('config', (err, data) => {
if (err) throw err;
console.log(data);
});
Output
[Error: EISDIR: illegal operation on a directory, read] {
errno: -21,
code: 'EISDIR',
syscall: 'read'
}
Fixing this error involves correcting the provided path so that it leads to a
file instead.
12. ENOTDIR
This error is the inverse of EISDIR
. It means a file argument was supplied
where a directory was expected. To avoid this error, ensure that the provided
path leads to a directory and not a file.
fs.opendir('/etc/passwd', (err, _dir) => {
if (err) throw err;
});
Output
[Error: ENOTDIR: not a directory, opendir '/etc/passwd'] {
errno: -20,
code: 'ENOTDIR',
syscall: 'opendir',
path: '/etc/passwd'
}
13. EACCES
The EACCES
error is often encountered when trying to access a file in a way
that is forbidden by its access permissions. You may also encounter this error
when you’re trying to install a global NPM package (depending on how you
installed Node.js and npm
), or when you try to run a server on a port lower
than 1024.
fs.readFile('/etc/sudoers', (err, data) => {
if (err) throw err;
console.log(data);
});
Output
[Error: EACCES: permission denied, open '/etc/sudoers'] {
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/etc/sudoers'
}
Essentially, this error indicates that the user executing the script does not
have the required permission to access a resource. A quick fix is to prefix the
script execution command with sudo
so that it is executed as root, but this is
a bad idea
for security reasons.
The correct fix for this error is to give the user executing the script the
required permissions to access the resource through the chown
command on Linux
in the case of a file or directory.
sudo chown -R $(whoami) /path/to/directory
If you encounter an EACCES
error when trying to listen on a port lower than
1024, you can use a higher port and set up port forwarding through iptables
.
The following command forwards HTTP traffic going to port 80 to port 8080
(assuming your application is listening on port 8080):
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
If you encounter EACCES
errors when trying to install a global npm
package,
it usually means that you installed the Node.js and npm
versions found in your
system’s repositories. The recommended course of action is to uninstall those
versions and reinstall them through a Node environment manager like
NVM or Volta.
14. EEXIST
The EEXIST
error is another filesystem error that is encountered whenever a
file or directory exists, but the attempted operation requires it not to exist.
For example, you will see this error when you attempt to create a directory that
already exists as shown below:
const fs = require('fs');
fs.mkdirSync('temp', (err) => {
if (err) throw err;
});
Output
Error: EEXIST: file already exists, mkdir 'temp'
at Object.mkdirSync (node:fs:1349:3)
at Object.<anonymous> (/home/ayo/dev/demo/main.js:3:4)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
errno: -17,
syscall: 'mkdir',
code: 'EEXIST',
path: 'temp'
}
The solution here is to check if the path exists through fs.existsSync()
before attempting to create it:
const fs = require('fs');
if (!fs.existsSync('temp')) {
fs.mkdirSync('temp', (err) => {
if (err) throw err;
});
}
15. EPERM
The EPERM
error may be encountered in various scenarios, usually when
installing an npm
package. It indicates that the operation being carried out
could not be completed due to permission issues. This error often indicates that
a write was attempted to a file that is in a read-only state although you may
sometimes encounter an EACCES
error instead.
Here are some possible fixes you can try if you run into this problem:
- Close all instances of your editor before rerunning the command (maybe some
files were locked by the editor). - Clean the
npm
cache withnpm cache clean --force
. - Close or disable your Anti-virus software if have one.
- If you have a development server running, stop it before executing the
installation command once again. - Use the
--force
option as innpm install --force
. - Remove your
node_modules
folder withrm -rf node_modules
and install them
once again withnpm install
.
Conclusion
In this article, we covered 15 of the most common Node.js errors you are likely
to encounter when developing applications or utilizing Node.js-based tools, and
we discussed possible solutions to each one. This by no means an exhaustive list
so ensure to check out the
Node.js errors documentation or the
errno(3) man page for a
more comprehensive listing.
Thanks for reading, and happy coding!
Check Uptime, Ping, Ports, SSL and more.
Get Slack, SMS and phone incident alerts.
Easy on-call duty scheduling.
Create free status page on your domain.
Got an article suggestion?
Let us know
Next article
How to Configure Nginx as a Reverse Proxy for Node.js Applications
→
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.