haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.08k stars 661 forks source link

Problem with reading null transaction in connection.js #821

Closed DarkSorrow closed 9 years ago

DarkSorrow commented 9 years ago

Hello,

I had a crash when a mail was sent and the connection dropped just after. Here is the log for the issue, after asking help on irc i was told the problem is probably at the line 1362 of the connection.js where haraka try to read the property of the transaction while this object is already deleted.

[DEBUG] [6EDCA448-61BE-4F49-B82C-54284C49D3CF] [core] hook=capabilities plugin=mb_config function=hook_capabilities params="" retval=CONT msg="" [PROTOCOL] [6EDCA448-61BE-4F49-B82C-54284C49D3CF] [core] S: 250-in.message-business.com Hello obs3.fbx.proxad.net [ip], Haraka is at your service. [PROTOCOL] [6EDCA448-61BE-4F49-B82C-54284C49D3CF] [core] S: 250-PIPELINING [PROTOCOL] [6EDCA448-61BE-4F49-B82C-54284C49D3CF] [core] S: 250-8BITMIME [PROTOCOL] [6EDCA448-61BE-4F49-B82C-54284C49D3CF] [core] S: 250-SIZE 10000000 [PROTOCOL] [6EDCA448-61BE-4F49-B82C-54284C49D3CF] [core] S: 250 STARTTLS [WARN] [22DF769A-7D9A-4216-86E3-644219C062D2.1] [core] client obs3.fbx.proxad.net [ip] dropped connection [DEBUG] [22DF769A-7D9A-4216-86E3-644219C062D2.1] [core] running reset_transaction hooks [DEBUG] [22DF769A-7D9A-4216-86E3-644219C062D2.1] [core] running disconnect hooks [DEBUG] [22DF769A-7D9A-4216-86E3-644219C062D2.1] [core] running disconnect hook in mb_config plugin [DEBUG] [22DF769A-7D9A-4216-86E3-644219C062D2.1] [core] hook=disconnect plugin=mb_config function=hook_disconnect params="" retval=CONT msg="" [DEBUG] [22DF769A-7D9A-4216-86E3-644219C062D2.1] [core] running disconnect hook in mb_communication plugin [NOTICE] [-] [mb_communication] No mail was processed for the database 20493 [DEBUG] [22DF769A-7D9A-4216-86E3-644219C062D2.1] [core] hook=disconnect plugin=mb_communication function=hook_disconnect params="" retval=CONT msg="" [NOTICE] [22DF769A-7D9A-4216-86E3-644219C062D2.1] [core] disconnect ip= rdns="obs3.fbx.proxad.net" helo="jmhazera-03" relay=Y early=N esmtp=Y tls=Y pipe=N txns=1 rcpts=1/0/0 msgs=0/0/0 bytes=0 lr="" time=28.578 [CRIT] [-] [core] TypeError: Cannot read property 'data_bytes' of null [CRIT] [-] [core] at Connection.data_done (/usr/lib/node_modules/Haraka/connection.js:1401:40) [CRIT] [-] [core] at MessageStream.end_callback (/usr/lib/node_modules/Haraka/connection.js:1371:18) [CRIT] [-] [core] at MessageStream._write (/usr/lib/node_modules/Haraka/messagestream.js:138:37) [CRIT] [-] [core] at /usr/lib/node_modules/Haraka/messagestream.js:187:22 [CRIT] [-] [core] at process._tickCallback (node.js:419:13) [NOTICE] [-] [core] Shutting down

smfreegard commented 9 years ago

Ok - having looked at this; it's no longer an issue in the git version as this code has been refactored and improved. You can workaround this in 2.5.0 by adding:

if (!this.transaction) return;

After line 1397 in connection.js: https://github.com/baudehlo/Haraka/blob/v2.5.0/connection.js#L1397