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

Getting the error "Assertion failed (wrap->ssl_) != (nullptr), file src\tls_wrap.cc, line 320" while module installation by npm #2979

Closed
SergeKornilov opened this issue Sep 21, 2015 · 47 comments
Labels
tls Issues and PRs related to the tls subsystem. windows Issues and PRs related to the Windows platform.

Comments

@SergeKornilov
Copy link

I get the error "Assertion failed (wrap->ssl_) != (nullptr), file src\tls_wrap.cc, line 320" trying to install any module by npm via proxy, for example, request or cheerio:

npm config set proxy http://username:password@proxy.company.com:8080
npm config set https-proxy https://username:password@proxy.company.com:8080

npm install cheerio

//

Thus, request module is not installed at all, and cheerio module is installed without dependencies.

//

npm --version
2.14.3

node --version
v4.1.0

OS: windows xp sp3

@ChALkeR ChALkeR added the tls Issues and PRs related to the tls subsystem. label Sep 21, 2015
@ChALkeR
Copy link
Member

ChALkeR commented Sep 21, 2015

cc @indutny

@rvagg
Copy link
Member

rvagg commented Sep 21, 2015

/cc @nodejs/crypto, @nodejs/platform-windows (windows xp sp3 sets off red flags for me)

@thefourtheye
Copy link
Contributor

Npm folks might also be interested. cc @othiym23 @zkat @iarna

@mscdex mscdex changed the title Getting the error "Assertion failed (wrap->ssl_) != (nullprt), file src\tls_wrap.cc, line 320" while module installation by npm Getting the error "Assertion failed (wrap->ssl_) != (nullptr), file src\tls_wrap.cc, line 320" while module installation by npm Sep 21, 2015
@indutny
Copy link
Member

indutny commented Sep 21, 2015

Will look at it today...

@indutny
Copy link
Member

indutny commented Sep 21, 2015

I think it may be related to the Windows XP indeed. Checking the libuv code with this regards.

@indutny
Copy link
Member

indutny commented Sep 21, 2015

Hm... looks like I was wrong about it, the order of callbacks should be correct even on XP. Continuing the search.

@indutny
Copy link
Member

indutny commented Sep 21, 2015

I think it may be a windows-specific thing. May I ask you to give a try to the following patch:

diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
index 1bff757..fc9696f 100644
--- a/lib/_tls_wrap.js
+++ b/lib/_tls_wrap.js
@@ -296,7 +296,11 @@ proxiedMethods.forEach(function(name) {

 tls_wrap.TLSWrap.prototype.close = function closeProxy(cb) {
   if (this._parentWrap && this._parentWrap._handle === this._parent) {
-    setImmediate(cb);
+    if (this._parentWrap._handle)
+      this._parentWrap.once('close', cb);
+    else
+      setImmediate(cb);
+
     return this._parentWrap.destroy();
   }
   return this._parent.close(cb);

Hopefully, it will fix the problem


@saghul a question about Windows and uv_close(). There is lots of endgames and everything for cancelling the request. Could it be the case that the uv_close_cb is not invoked on next libuv tick on Windows?

indutny added a commit to indutny/io.js that referenced this issue Sep 21, 2015
When closing the child TLSWrap handle - wait for the proper parent's
handle close callback invocation. `uv_close_cb` may be invoked much
later than the next libuv tick, depending on the platform.

Fix: nodejs#2979
@indutny
Copy link
Member

indutny commented Sep 21, 2015

Relevant PR: #2991

@saghul
Copy link
Member

saghul commented Sep 22, 2015

a question about Windows and uv_close(). There is lots of endgames and everything for cancelling the request. Could it be the case that the uv_close_cb is not invoked on next libuv tick on Windows?

Yes, AFAIK cancellation could take a bit, so the uv_close callback is not guaranteed to run exactly on the next tick.

@indutny
Copy link
Member

indutny commented Sep 24, 2015

@SergeKornilov may I ask you to test this patch? I have really good expectations from it. Let me know if you need some help with building this thing.

@SergeKornilov
Copy link
Author

@indutny It something goes wrong when I try to build node.js. I follow installation guide:

  1. Start "Visual Studio Command prompt (2010)"
  2. Execute "set path=c:\python27;c:\python27\lib;%path%"
  3. Execute "python --version" to check and get the result "Python 2.7.10"
  4. Then execute "vcbuild.bat release x86" and get nothing.

What's wrong here? obsolet version of VS?

@indutny
Copy link
Member

indutny commented Sep 25, 2015

cc @nodejs/release how do we do builds for Windows?

@Fishrock123
Copy link
Contributor

@nodejs/build ^^

@saghul
Copy link
Member

saghul commented Sep 25, 2015

I always do it from cmd.exe, give it a shot.
On Sep 25, 2015 8:20 AM, "SergeKornilov" notifications@github.com wrote:

@indutny https://github.com/indutny It something goes wrong when I try
to build node.js. I follow installation guide:

  1. Start "Visual Studio Command prompt (2010)"
  2. Execute "set path=c:\python27;c:\python27\lib;%path%"
  3. Execute "python --version" to check and get the result "Python
    2.7.10"
  4. Then execute "vcbuild.bat release x86" and get nothing.

What's wrong here? obsolet version of VS?


Reply to this email directly or view it on GitHub
#2979 (comment).

@SergeKornilov
Copy link
Author

screenshot

What can I do to clearify the situation and get more verbous output from vcbuild?

@seishun
Copy link
Contributor

seishun commented Sep 25, 2015

VS 2010 support was dropped a long time ago. You need at least VS 2013.

@SergeKornilov
Copy link
Author

What is about Windows SDK 7.1?

@seishun
Copy link
Contributor

seishun commented Sep 25, 2015

Unless Windows SDK includes a compiler, its version is not relevant.

@saghul
Copy link
Member

saghul commented Sep 25, 2015

VS 2010 support was dropped a long time ago. You need at least VS 2013.

In Node? When?

Unless Windows SDK includes a compiler, its version is not relevant.

Windows SDk 7 and 7.1 do include a compiler.

@seishun
Copy link
Contributor

seishun commented Sep 25, 2015

In Node? When?

In 370e821.

Windows SDk 7 and 7.1 do include a compiler.

That's interesting. Is it an alternative to VS then? Anyway, I'm not sure how or if node would work with it, as vcbuild.bat looks for environment variables set by VS.

@saghul
Copy link
Member

saghul commented Sep 25, 2015

Thanks, I didn't know that! In libuv we support VS >= 2008 :-)

That's interesting. Is it an alternative to VS then? Anyway, I'm not sure how or if node would work with it, as vcbuild.bat looks for environment variables set by VS.

Not really. AFAIK Windows SDK >= 8 no longer includes any compiler.

IIRC you could compile stuff for x64 with VS 2012 express + the SDK.

@SergeKornilov
Copy link
Author

Here, on an another computer with Windows SDK 7.1 and Python 2.7 only:

screenshot2

So, I guess the following (from Installation)

You need to have Microsoft Visual Studio 2012/2010 (Express edition is fine) as well as Python 2.6/2.7.

is not actual now at least for 4.x version.

@orangemocha
Copy link
Contributor

What can I do to clearify the situation and get more verbous output from vcbuild?

@SergeKornilov : edit vcbuild.bat and remove (or comment with REM) the first line. Eg:

REM @echo off

@SergeKornilov
Copy link
Author

Well, here it is (last lines of the output):

C:\nodejsbuild\node-master>set NODE_VERSION=
C:\nodejsbuild\node-master>set TAG=
C:\nodejsbuild\node-master>set FULLVERSION=
C:\nodejsbuild\node-master>for /F "usebackq tokens=*" %i in (`python "C:\nodejsbuild\node-master\tools\getnodeversion.py"`) do s
et NODE_VERSION=%i
C:\nodejsbuild\node-master>set NODE_VERSION=5.0.0
C:\nodejsbuild\node-master>rem echo 5.0.0
C:\nodejsbuild\node-master>if not defined NODE_VERSION (
echo Cannot determine current version of Node.js
 exit /b 1
)
C:\nodejsbuild\node-master>if not defined DISTTYPE set DISTTYPE=release
C:\nodejsbuild\node-master>if "release" == "release" (
set FULLVERSION=5.0.0
 goto exit
)
C:\nodejsbuild\node-master>if not defined DISTTYPEDIR set DISTTYPEDIR=release
C:\nodejsbuild\node-master>goto :EOF
C:\nodejsbuild\node-master>

@orangemocha
Copy link
Contributor

I haven't tried this myself, but as far as I know VS2013 can only be installed on Windows 7 or later (or the corresponding server editions, Windows Server 2008 R2 or later). And since building Node requires VS2013 or VS2015, that disqualifies XP as a build machine.

@SergeKornilov
Copy link
Author

As far as I can see I need Windows 7 with VS2013, only then I can build node targeted it for XP, right?

@orangemocha
Copy link
Contributor

Correct. You might as well go to the latest and greatest and use VS2015. You'll need Windows 7 SP1 minimum.

Looking at your output above, there also seems to be a bug in vcbuild.bat. For one thing, I can see that it contains two labels named the same (:exit). Hopefully this only causes problems on XP. Please let us know if you still have problems on later OS versions.

@orangemocha
Copy link
Contributor

As a side thought, I wonder if the VS 2013 minimum requirement also applies to compiling native modules. If that is the case, it would mean that Node on XP is seriously limited.

@SergeKornilov
Copy link
Author

Ok. I'll try to build node on Win7 a bit later... I have only to install VS 2013. Merlin's beard! I just wanted to install cheerio module via npm 😃.

@janaka1379
Copy link

I am using windows 10. I also having that issue.
"Assertion failed (wrap->ssl_) != (nullptr), file src\tls_wrap.cc, line 320"
Any one have solutions?

@indutny
Copy link
Member

indutny commented Sep 29, 2015

@janaka1379 we probably have one! May I ask you to give a try to that patch?

@Fishrock123
Copy link
Contributor

Any update? @janaka1379 did you try using the patch? (#2991)

Edited: I think fedor meant this patch

@nullivex
Copy link

nullivex commented Oct 7, 2015

I am seeing this issue too when testing my platform that worked on previous node versions.

I will attempt to build with this patch and let you know.

@SergeKornilov
Copy link
Author

The latest version of node.js (4.1.2) has the same problem.

@indutny
Copy link
Member

indutny commented Oct 7, 2015

@SergeKornilov of course it does, I haven't landed the patch yet.

@ChALkeR ChALkeR added the windows Issues and PRs related to the Windows platform. label Oct 7, 2015
@ChALkeR
Copy link
Member

ChALkeR commented Oct 7, 2015

@indutny Am I correct that the problem could be observed only on windows platform?

@indutny
Copy link
Member

indutny commented Oct 7, 2015

@ChALkeR so far it looks like this

@veneMarcos
Copy link

I have the same problem in Win XP.
I try install a express with command line npm install express -g and I get the msg ""Assertion failed (wrap->ssl_) != (nullptr), file src\tls_wrap.cc, line 320"

@veneMarcos
Copy link

Where do I put this code?

  • I do not find the file tls_wrap.cc.

@ChALkeR
Copy link
Member

ChALkeR commented Oct 8, 2015

@veneMarcos tls_wrap.cc is here: https://github.com/nodejs/node/blob/master/src/tls_wrap.cc , but I'm not exactly sure why are you trying to find it. The patch is against _tls_wrap.js, which could be found here: https://github.com/nodejs/node/blob/master/lib/_tls_wrap.js .

@wwwork
Copy link

wwwork commented Oct 12, 2015

I get the same error on win xp, when I've run npm install

npm --proxy http://191.168.1.1:3128 --without-ssl --insecure install string.
I think it because I using proxy in my local arean network.

node --version
v4.1.2

indutny added a commit that referenced this issue Oct 12, 2015
When closing the child TLSWrap handle - wait for the proper parent's
handle close callback invocation. `uv_close_cb` may be invoked much
later than the next libuv tick, depending on the platform.

The only platform that currently seem to defer `uv_close_cb` is Windows
XP. This behavior was not observed on other Windows systems, and is not
possible on Unixes.

Fix: #2979
PR-URL: #2991
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@indutny
Copy link
Member

indutny commented Oct 12, 2015

Please give it a try to node.js 4.2.0 . The problem should be fixed there.

@SergeKornilov
Copy link
Author

Thank you very much! 4.2.0 really works great!

@veneMarcos
Copy link

Thank you, this version 4.2.0 works fine.

@indutny
Copy link
Member

indutny commented Oct 13, 2015

Whoa, looks like it was a good call to include that fix into release. Thank you!

@mypuem
Copy link

mypuem commented Apr 11, 2016

I'm seeing this issue in node 4.4 running on win 7 and ubuntu 14.04.4 LTS. The error is printed when an ssl socket is closed. I'm only using the built in modules http, https, crypto. My code runs fine without the https module. Sorry if I've posted in the wrong place but this is the only reference I can find to this error. The error message is "Assertion failed: (wrap->ssl_) != (nullptr), file src\tls_wrap.cc, line 319".

@bnoordhuis
Copy link
Member

@mypuem If you still get that with the latest v4.x release (v4.4.2 at the time of writing), can you file a new issue and include steps to reproduce? The test case should preferably not depend on any third-party modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tls Issues and PRs related to the tls subsystem. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging a pull request may close this issue.