Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8057825

emitted socket arg becomes null in avatar.js http tests

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u40
    • Fix Version/s: 8u40
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Introduced In Build:
      b04
    • Introduced In Version:
    • Resolved In Build:
      b15
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        A new regression has been identified in 8u40 b04. When running some of the http tests of avatar.js with this build of the jdk, emitted socket becomes undefined. For example, applying this diagnostic patch to http.js, and running the test test-http-timeout.js, we get this output -

        @@ -1725,9 +1725,11 @@
         }
         
         ClientRequest.prototype.onSocket = function(socket) {
        + print('ClientRequest.prototype.onSocket ' + socket + ' type ' + (typeof socket));
           var req = this;
         
           process.nextTick(function() {
        + print('ClientRequest.prototype.onSocket.nextTick ' + socket + ' type ' + (typeof socket));
             var parser = parsers.alloc();
             req.socket = socket;
             req.connection = socket;
        @@ -1755,6 +1757,7 @@
             socket.onend = socketOnEnd;
             socket.on('close', socketCloseListener);
             parser.onIncoming = parserOnIncomingClient;
        + print('ClientRequest.prototype.onSocket.nextTick.emitting ' + socket + ' type ' + (typeof socket));
             req.emit('socket', socket);
           });


        java -jar dist/avatar-js.jar test/simple/test-http-timeout.js
        ClientRequest.prototype.onSocket [object Object] type object
        ClientRequest.prototype.onSocket.nextTick [object Object] type object
        ClientRequest.prototype.onSocket.nextTick.emitting [object Object] type object
        Exception in thread "main" TypeError: Cannot read property "setTimeout" from undefined in jar:file:/home/akhil/ws/avatar-js/dist/avatar-js.jar!/lib/http.js at line number 1822
        at <anonymous> (jar:file:/home/akhil/ws/avatar-js/dist/avatar-js.jar!/lib/http.js:1822)
        at <anonymous> (jar:file:/home/akhil/ws/avatar-js/dist/avatar-js.jar!/lib/events.js:180)
        at <anonymous> (jar:file:/home/akhil/ws/avatar-js/dist/avatar-js.jar!/lib/events.js:117)
        at <anonymous> (jar:file:/home/akhil/ws/avatar-js/dist/avatar-js.jar!/lib/http.js:1761)

        Note that 'socket' is not undefined when emitted at http.js:1761, but becomes undefined at line http.js:1822.

        Perhaps the deep inheritance hierarchy is a factor? ClientRequest extends OutgoingMessage extends Stream extends EventEmitter.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  lagergren Marcus Lagergren
                  Reporter:
                  akhil Akhil Arora (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: