This repository has been archived by the owner. It is now read-only.

Aborted (core dumped) on IMAP Search #5058

Closed
skeggse opened this Issue Mar 17, 2013 · 5 comments

Comments

Projects
None yet
3 participants

skeggse commented Mar 17, 2013

While this does involve the node-imap module, it appears to be a problem with the crypto module, related to the recent changes between v0.8 and v0.10.

From mscdex/node-imap#185:

I'm trying to do some sort of unread message counter, and the push events via IMAP aren't good enough, so I'm just polling every ten seconds. Unfortunately, the first time my setTimeout callback is called, something in crypto fails and my script crashes with Aborted (core dumped).

There are 1 unread messages
node: ../src/node_crypto.cc:962: void node::crypto::Connection::ClearError(): Assertion `handle_->Get(String::New("error"))->BooleanValue() == false' failed.
Aborted (core dumped)

I don't known enough about node's C++ internals to figure out if this is a problem with node itself or node-imap.

Code to reproduce:

var Imap = require('imap');

var imap = new Imap({
  user: "human@gmail.sorta",
  password: "myrandompassword",
  host: 'imap.gmail.com',
  port: 993,
  secure: true
});

var count = -1;

imap.connect(function(err) {
  if (err)
    throw err;
  imap.openBox('INBOX', true, function(err, box) {
    if (err)
      throw err;
    var update = function() {
      imap.search(['UNSEEN'], function(err, results) {
        if (err)
          throw err;
        var diff = results.length - count;
        count = results.length;
        if (diff !== 0)
          console.log("There are " + count + " unread messages");
      });
    };
    // this is probably good enough
    imap.on('mail', function(number) {
      console.log("There are " + (count += number) + " unread messages");
    });
    // update every 10 seconds
    var interval = setInterval(update, 10000);
    update();
  });
});
Owner

indutny commented Mar 18, 2013

Could you please try testing it with this fix: indutny/node@315bba3 ?

indutny added a commit that referenced this issue Mar 20, 2013

tls: always reset this.ssl.error after handling
Otherwise assertion may happen:

    src/node_crypto.cc:962: void node::crypto::Connection::ClearError():
    Assertion `handle_->Get(String::New("error"))->BooleanValue() == false'
    failed.

See #5058
Owner

indutny commented Mar 20, 2013

Fixed in 34e22b8.

@indutny indutny closed this Mar 20, 2013

I had a similar problem when using the node-imap module. Nodejs version 0.10.1. But I still get the error: node: ../src/node_crypto.cc:962: void node::crypto::Connection::ClearError(): Assertion `handle_->Get(String::New("error"))->BooleanValue() == false' failed.
Aborted (core dumped)

@himera444 himera444 referenced this issue in mscdex/node-imap Mar 27, 2013

Closed

Aborted (core dumped) on Search #185

indutny added a commit to indutny/node that referenced this issue Mar 27, 2013

tls: handle errors before calling C++ methods
Calling `this.pair.encrypted._internallyPendingBytes()` before
handling/resetting error will result in assertion failure:

../src/node_crypto.cc:962: void node::crypto::Connection::ClearError():
Assertion `handle_->Get(String::New("error"))->BooleanValue() == false'
failed.

see #5058
Owner

indutny commented Mar 27, 2013

This is one more fix with test: joyent#5152

@indutny indutny reopened this Mar 27, 2013

indutny added a commit that referenced this issue Mar 27, 2013

tls: handle errors before calling C++ methods
Calling `this.pair.encrypted._internallyPendingBytes()` before
handling/resetting error will result in assertion failure:

../src/node_crypto.cc:962: void node::crypto::Connection::ClearError():
Assertion `handle_->Get(String::New("error"))->BooleanValue() == false'
failed.

see #5058
Owner

indutny commented Mar 27, 2013

Should be fixed in ae86fa8.

@indutny indutny closed this Mar 27, 2013

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.