Skip to content

Assertion failed: (uv__stream_fd(stream) >= 0), function uv_read_start, file ../deps/uv/src/unix/stream.c, line 1477. #987

Description

@sergenikitin

It happens when I used https://github.com/mscdex/node-imap on io.js 1.4.1 (on mac os).
On <= 1.3.0 node-imap worked good.

Activity

  1. bnoordhuis commented on Feb 27, 2015

    @bnoordhuis
    Member

    Can you report this to mscdex/node-imap first, please? It might be a bug in that module that flew under the radar until now. If not, @mscdex should holler and I'll reopen the issue. Thanks.

  2. vkurchatkin commented on Feb 27, 2015

    @vkurchatkin
    Contributor

    It looks like node-imap is pure js, so it is probably io.js bug

  3. vkurchatkin commented on Feb 27, 2015

    @vkurchatkin
    Contributor

    @gnostic do you have a way to reproduce this issue? what you do reverts libuv/libuv@19d3d50

  4. mscdex commented on Feb 27, 2015

    @mscdex
    Contributor

    @bnoordhuis As @vkurchatkin said, imap is pure js, so the error is happening in io.js C++ land.

  5. sergenikitin commented on Mar 1, 2015

    @sergenikitin
    Author

    io.js v1.4.2 has the same problem.

  6. rvagg commented on Mar 1, 2015

    @rvagg
    Member

    @sergenikitin are you on Windows? if so, see #1005 and perhaps #1008 is relevant?

  7. sergenikitin commented on Mar 1, 2015

    @sergenikitin
    Author

    @rvagg no, OS X 10.10.2

  8. rvagg commented on Mar 1, 2015

    @rvagg
    Member

    /cc @indutny this looks relevant to your stream changes

  9. indutny commented on Mar 2, 2015

    @indutny
    Member

    @gnostic does following patch fix the problem for you?

    diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c
    index 518a2fc..ade6b90 100644
    --- a/deps/uv/src/unix/stream.c
    +++ b/deps/uv/src/unix/stream.c
    @@ -393,10 +393,13 @@ int uv__stream_open(uv_stream_t* stream, int fd, int flags) {
    
     #if defined(__APPLE__)
       enable = 1;
    -  if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &enable, sizeof(enable)) &&
    -      errno != ENOTSOCK &&
    -      errno != EINVAL) {
    -    return -errno;
    +  if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &enable, sizeof(enable))) {
    +    if (errno != ENOTSOCK &&
    +        errno != EINVAL) {
    +      return -errno;
    +    } else {
    +      errno = 0;
    +    }
       }
     #endif
    
  10. sergenikitin commented on Mar 3, 2015

    @sergenikitin
    Author

    @indutny
    I checked this patch, it's not fix the problem. Still have

    Assertion failed: (uv__stream_fd(stream) >= 0), function uv_read_start, file ../deps/uv/src/unix/stream.c, line 1480.
    Abort trap: 6
    
  11. indutny commented on Mar 3, 2015

    @indutny
    Member

    @sergenikitin is there any way to reproduce it?

  12. indutny commented on Mar 3, 2015

    @indutny
    Member

    Ok, a test case:

    var tls = require('tls');
    var net = require('net');
    
    var socket = new net.Socket();
    
    var s = tls.connect({
      socket: socket,
      servername: 'google.com'
    }, function() {
      console.log('secure');
    });
    
    socket.connect(443, 'google.com');
  13. indutny commented on Mar 3, 2015

    @indutny
    Member

    @bnoordhuis @vkurchatkin @rvagg I have two solutions:

    • assume that net.Socket is a JSStream if it has yet no _handle (i.e. .connect() wasn't called)
    • allow adding parent socket handle to TLSSocket after creating it

    The first solution is very easy to implement and should generally get various code like that test case working without any problems, except probably reduced bandwidth.

    The second one is a bit complicated and might take some time to implement.

    What do you think about doing (1) and then (2)?

  14. bnoordhuis commented on Mar 3, 2015

    @bnoordhuis
    Member

    @indutny Is what you are proposing in (1) spiritually equivalent to:

    if (!socket._handle) {
      socket.once('connect', function() {
        // continue with tls.connect()?
      });
      return;
    }

    ?

  15. added a commit that references this issue on Mar 3, 2015
  16. indutny commented on Mar 3, 2015

    @indutny
    Member

    @bnoordhuis like this #1046

  17. added a commit that references this issue on Mar 3, 2015
  18. added a commit that references this issue on Jun 21, 2026
    b07e414
  19. added 2 commits that reference this issue on Jun 22, 2026
    e9a9065
    bbef54b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions