Skip to content
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

TypeError: Method get TypedArray.prototype.length called on incompatible receiver #2201

Closed
KingNoosh opened this issue Oct 10, 2017 · 2 comments
Labels

Comments

@KingNoosh
Copy link
Member

system info

Haraka Haraka.js — Version: 2.8.15
Node v6.11.4
OS Linux REDACTED_HOSTNAME 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux
openssl OpenSSL 1.0.2g 1 Mar 2016

Expected behavior

Not to crash

Observed behavior

Server crased with the following error

2017-10-05T09:30:57.064Z level=CRIT uuid=- origin=core message="TypeError: Method get TypedArray.prototype.length called on incompatible receiver [object Object]"
2017-10-05T09:30:57.064Z level=CRIT uuid=- origin=core message="    at Buffer.get length [as length] (native)"
2017-10-05T09:30:57.064Z level=CRIT uuid=- origin=core message="    at Buffer.toString (buffer.js:490:36)"
2017-10-05T09:30:57.064Z level=CRIT uuid=- origin=core message="    at Body.events.EventEmitter.Body.try_iconv (/usr/src/app/node_modules/Haraka/mailbody.js:326:29)"
2017-10-05T09:30:57.065Z level=CRIT uuid=- origin=core message="    at Body.events.EventEmitter.Body.parse_end (/usr/src/app/node_modules/Haraka/mailbody.js:311:10)"
2017-10-05T09:30:57.065Z level=CRIT uuid=- origin=core message="    at Body.events.EventEmitter.Body.parse_child (/usr/src/app/node_modules/Haraka/mailbody.js:56:55)"
2017-10-05T09:30:57.065Z level=CRIT uuid=- origin=core message="    at Body.events.EventEmitter.Body.parse_more (/usr/src/app/node_modules/Haraka/mailbody.js:49:39)"
2017-10-05T09:30:57.065Z level=CRIT uuid=- origin=core message="    at Transaction.add_data (/usr/src/app/node_modules/Haraka/transaction.js:106:34)"
2017-10-05T09:30:57.065Z level=CRIT uuid=- origin=core message="    at Connection.accumulate_data (/usr/src/app/node_modules/Haraka/connection.js:1658:22)"
2017-10-05T09:30:57.065Z level=CRIT uuid=- origin=core message="    at Connection.process_line (/usr/src/app/node_modules/Haraka/connection.js:313:14)"
2017-10-05T09:30:57.065Z level=CRIT uuid=- origin=core message="    at Connection._process_data (/usr/src/app/node_modules/Haraka/connection.js:496:18)"
2017-10-05T09:30:57.066Z level=NOTICE uuid=- origin=core message="Shutting down"

Steps to reproduce

Unknown

@KingNoosh KingNoosh added the Bug label Oct 10, 2017
@Chopinsky
Copy link
Contributor

Chopinsky commented Nov 22, 2017

Culprit seems to be from this line:

this.bodytext = buf.toString();

Somehow the buffer object isn't initialized correctly, which then cause the crash because the length property getter doesn't exist on the Buffer object, from this line in node module's buffer.js:

https://github.com/nodejs/node/blob/3701b0230961644186fbc4ea2d6ef978601ac0f6/lib/buffer.js#L647

Very weird issue, not sure this is a bug for Node or Haraka.

@msimerson
Copy link
Member

Since we're not sure and no activity in a year, I'm closing this. It doesn't seem likely but if "Somehow the buffer object isn't initialized correctly" is the underlying issue, #2553 might help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants