Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Aborted (core dumped) on IMAP Search #5058

Closed
skeggse opened this Issue · 5 comments

3 participants

@skeggse

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();
  });
});
@indutny
Owner

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

@indutny indutny referenced this issue from a commit
@indutny indutny 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
34e22b8
@indutny
Owner

Fixed in 34e22b8.

@indutny indutny closed this
@himera444

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
Closed

Aborted (core dumped) on Search #185

@indutny indutny referenced this issue from a commit in indutny/node
@indutny indutny 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
3017f96
@indutny
Owner

This is one more fix with test: #5152

@indutny indutny reopened this
@indutny indutny referenced this issue from a commit
@indutny indutny 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
ae86fa8
@indutny
Owner

Should be fixed in ae86fa8.

@indutny indutny closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.