Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Test failure with Julia release-v0.4 #75

Closed
rjagerman opened this issue Sep 14, 2015 · 12 comments
Closed

Test failure with Julia release-v0.4 #75

rjagerman opened this issue Sep 14, 2015 · 12 comments

Comments

@rjagerman
Copy link

I have performed a clean build of the latest release-v0.4 branch of Julia. Afterwards I have added the requests library by using Pkg.add("Requests"). Testing the library (as well as using basic functionality, such as get()) causes errors on my system (Red Hat enterprise linux 7):

julia> Pkg.init()
INFO: Initializing package repository /local/.julia/v0.4
INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl

julia> Pkg.add("Requests")
INFO: Installing BinDeps v0.3.15
INFO: Installing Codecs v0.1.4
INFO: Installing Compat v0.7.0
INFO: Installing HttpCommon v0.2.3
INFO: Installing HttpParser v0.1.0
INFO: Installing JSON v0.4.5
INFO: Installing MbedTLS v0.1.3
INFO: Installing Requests v0.3.1
INFO: Installing SHA v0.1.1
INFO: Installing URIParser v0.1.0
INFO: Installing Zlib v0.1.9
INFO: Building HttpParser
INFO: Precompiling module Compat...
INFO: Precompiling module URIParser...
INFO: Precompiling module SHA...
INFO: Building MbedTLS
INFO: Attempting to Create directory /local/.julia/v0.4/MbedTLS/deps/downloads
INFO: Downloading file https://tls.mbed.org/download/mbedtls-2.1.0-apache.tgz
....... ommitted a lot of compile information from MbedTLS .....
[100%] Building C object tests/CMakeFiles/test_suite_xtea.dir/test_suite_xtea.c.o
Linking C executable test_suite_xtea
[100%] Built target test_suite_xtea
INFO: Package database updated

julia> Pkg.test("Requests")
INFO: Testing Requests
ERROR (unhandled task failure): ArgumentError: cannot convert NULL to string
 in on_header_value at /local/.julia/v0.4/Requests/src/parsing.jl:92

The tests do not continue after the error message. I get the same error when trying to use basic HTTP functionality, e.g. get("https://www.google.com/").

Any idea what could cause this?

@malmaud
Copy link
Contributor

malmaud commented Sep 14, 2015

I'll look into it today.

@malmaud
Copy link
Contributor

malmaud commented Sep 14, 2015

Can you try Pkg.test("HttpParser")?

@malmaud
Copy link
Contributor

malmaud commented Sep 14, 2015

Actually, try Pkg.checkout("Requests") and see if that works.

@rjagerman
Copy link
Author

Thanks for the quick response!

Pkg.test("HttpParser") runs into the same problem:

julia> Pkg.test("HttpParser")
INFO: Testing HttpParser
ERROR: LoadError: ArgumentError: cannot convert NULL to string
 in on_header_value at /local/.julia/v0.4/HttpParser/test/runtests.jl:65
while loading /local/.julia/v0.4/HttpParser/test/runtests.jl, in expression starting on line 130
============================================================================[ ERROR: HttpParser ]=============================================================================

failed process: Process(`/local/julia/usr/bin/julia --check-bounds=yes --code-coverage=none --color=yes /local/.julia/v0.4/HttpParser/test/runtests.jl`, ProcessExited(1)) [1]

==============================================================================================================================================================================
ERROR: HttpParser had test errors
 in error at ./error.jl:21
 in test at pkg/entry.jl:753
 in anonymous at pkg/dir.jl:31
 in cd at ./file.jl:22
 in cd at pkg/dir.jl:31
 in test at pkg.jl:71

Here are the results for checkout, build and test:

julia> Pkg.checkout("Requests")
INFO: Checking out Requests master...
INFO: Pulling Requests latest master...
INFO: No packages to install, update or remove

julia> Pkg.build("Requests")
INFO: Building HttpParser
INFO: Building MbedTLS

julia> Pkg.test("Requests")
INFO: Testing Requests
INFO: Recompiling stale cache file /local/.julia/lib/v0.4/MbedTLS.ji for module MbedTLS.
INFO: Recompiling stale cache file /local/.julia/lib/v0.4/Requests.ji for module Requests.
INFO: Recompiling stale cache file /local/.julia/lib/v0.4/HttpParser.ji for module HttpParser.
ERROR (unhandled task failure): ArgumentError: cannot convert NULL to string
 in on_header_value at /local/.julia/v0.4/Requests/src/parsing.jl:92

I have tried to figure out which variable exactly is NULL (and why) by printing out the variables in src/parsing.jl at line 92, but I'm unable to uncover the exact reason. Adding println statements doesn't cause anything to show up in the REPL (I'm assuming that's because these callbacks are called by the joyent http-parser library on a different thread, although I'm not 100% sure how this works).

Edit: The actual error occurs at line 86, not as incorrectly reported at line 92. The variable at passed to the function is Ptr{Int8} @0x0000000000000000 for some reason.

@rjagerman
Copy link
Author

As a sanity check I build julia v0.3.11 and tested the Requests package on there. It seems to run into the same issue:

julia> Pkg.test("Requests")
INFO: Testing Requests
WARNING: This version of the GnuTLS library (3.3.8) is deprecated
and contains known security vulnerabilities. Please upgrade to a
more recent version.
ERROR: test error during get("http://httpbin.org/get").status === 200
cannot convert NULL to string
 in on_header_value at /local/.julia/v0.3/Requests/src/Requests.jl:176
while loading /local/.julia/v0.3/Requests/test/runtests.jl, in expression starting on line 11
=======================================================[ ERROR: Requests ]=======================================================

failed process: Process(`/local/julia-0.3/usr/bin/julia /local/.julia/v0.3/Requests/test/runtests.jl`, ProcessExited(1)) [1]

=================================================================================================================================
INFO: No packages to install, update or remove
ERROR: Requests had test errors
 in error at error.jl:21
 in test at pkg/entry.jl:718
 in anonymous at pkg/dir.jl:28
 in cd at ./file.jl:20
 in cd at pkg/dir.jl:28
 in test at pkg.jl:67

Therefore it does not seem like the issue is related to the new version of Julia. It might possibly be some configuration issue on my end? Since the error is kind of vague I'm not sure what I'm looking for. Additionally, both julia v0.4.0-rc1 and v0.3.11 work fine with the Requests package on my MacBook.

@malmaud
Copy link
Contributor

malmaud commented Sep 16, 2015

I wonder if something is wrong with your installed version of joyent's http-parser, or that the installed version is too old. Is there a system version of libhttp_parser.so installed on your Linux machine already in some system path? If so, try upgrading it to the newest version.

@rjagerman
Copy link
Author

Thanks! 👍 That was indeed the problem. There was a pre-installed version of joyent's http-parser (v2.0). Upgrading to v2.1 fixed the problems and everything works correctly now:

julia> Pkg.test("Requests")
INFO: Testing Requests
INFO: Requests tests passed

julia> using Requests

julia> resp = get("http://www.google.com/")
Response(200 OK, 16 headers, 154283 bytes in body)

Interesting side note: if you upgrade to a version higher than 2.1 (e.g. 2.5) you get an even weirder error:

julia> Pkg.test("Requests")
INFO: Testing Requests
ERROR (unhandled task failure): ReadOnlyMemoryError()

@prcastro
Copy link

Well, I'm running into the error @rjagerman said about the http-parser version being higher than 2.1.

@ghost
Copy link

ghost commented Feb 20, 2016

hi, i have the same problem of failing to run Pkg.test("HttpParser") or Pkg.test("Requests'). I install Julia v0.4.3 (also try v0.5 - same errors) on CentOS 7. From this email thread, it looks like the root cause is HttpParser but i don't know how to reinstall v2.1. I tried checking out HttpParser, and do a "make library" to generate libhttpparser.so but Julia v0.4.3 on CentOS7 seems to use libhttpparser.so.2 (64-bit).

This symptom manifests errors in
ERROR (unhandled task failure): ArgumentError: cannot convert NULL to string
in on_header_value at /root/.julia/v0.4/HttpServer/src/RequestParser.jl:60

any pointer how i can solve these issues?
thanks

@aviks
Copy link
Member

aviks commented Feb 21, 2016

Hi @audacyDevOps : v2.1 refers to the release of the native 'http-parser' library, not its Julia wrapper package. See here https://github.com/nodejs/http-parser/releases/tag/v2.1

The Julia wrapper is built to work with v2.1 of this library. Normally, it would build its own copy with the right version. However, you likely have a version of this library installed with your operating system. If possible you can remove this library from your OS, and rebuild the julia package with Pkg.build("HttpParser"). Otherwise, you might have to build your own version of the .so, and ensure Julia can find the right version.

@ghost
Copy link

ghost commented Feb 22, 2016

Hi aviks, I did a brute-force replacement of libhttp_parser.so.* by v2.1 that you refer to (i.e. run the command "make library" on httpparser github v2.1, and use the output libhttp_parser.so to replace /usr/lib64/libhttp_parser.so.*).

I also checkout and build JuliaWebAPI and found a new error:

  1. Following your wiki to test JuliaWebAPI, Julia console complains:
julia> using JuliaWebAPI
WARNING: Method definition info(Any...) in module Base at util.jl:334 overwritten in module Logging at /root/.julia/v0.4/Logging/src/Logging.jl:61.
WARNING: Method definition warn(Any...) in module Base at util.jl:364 overwritten in module Logging at /root/.julia/v0.4/Logging/src/Logging.jl:61.

julia> const apiclnt = APIInvoker("tcp://127.0.0.1:9999")
JuliaWebAPI.APIInvoker(ZMQ.Context(Ptr{Void} @0x0000000001f10c70,[ZMQ.Socket(Ptr{Void} @0x0000000001f10300,Base._FDWatcher(Ptr{Void} @0x0000000001a84690,(1,0),Condition(Any[]),(false,false)))]),ZMQ.Socket(Ptr{Void} @0x0000000001f10300,Base._FDWatcher(Ptr{Void} @0x0000000001a84690,(1,0),Condition(Any[]),(false,false))))

julia> run_rest(apiclnt, 8080)
ERROR (unhandled task failure): MethodError: `call` has no method matching call(::UndefVarError, ::ASCIIString)
Closest candidates are:
  BoundsError()
  BoundsError(::Any...)
  DivideError()
  ...
 in on_error at /root/.julia/v0.4/JuliaWebAPI/src/RESTServer.jl:71
 in on_message_complete at /root/.julia/v0.4/HttpServer/src/HttpServer.jl:406
 in on_message_complete at /root/.julia/v0.4/HttpServer/src/RequestParser.jl:104

From a separate terminal, I run "julia srvr.jl" from your wiki.

  1. After installing libhttp_parser.so.*, JuliaWebAPI does not pass tests at all.
    I re-checkout JuliaWebAPI and re-ran test. Same errors:
julia> Pkg.test("JuliaWebAPI")
INFO: Testing JuliaWebAPI
WARNING: Method definition info(Any...) in module Base at util.jl:334 overwritten in module Logging at /root/.julia/v0.4/Logging/src/Logging.jl:61.
WARNING: Method definition warn(Any...) in module Base at util.jl:364 overwritten in module Logging at /root/.julia/v0.4/Logging/src/Logging.jl:61.
spawining `/usr/bin/julia /root/.julia/v0.4/JuliaWebAPI/test/srvr.jl`
testing httpresponse...
    testfn1: Response(500 Internal Server Error, 4 headers, 38 bytes in body)
        data: UInt8[0x7b,0x22,0x64,0x61,0x74,0x61,0x22,0x3a,0x22,0x69,0x6e,0x76,0x61,0x6c,0x69,0x64,0x20,0x64,0x61,0x74,0x61,0x20,0x3a,0x20,0x2d,0x33,0x22,0x2c,0x22,0x63,0x6f,0x64,0x65,0x22,0x3a,0x2d,0x33,0x7d]
        hdrs: Dict{AbstractString,AbstractString}("Content-Type"=>"text/html; charset=utf-8","Date"=>"Mon, 22 Feb 2016 18:04:15","Content-Language"=>"en","Server"=>"Julia/0.4.3")
    testfn1: Response(500 Internal Server Error, 4 headers, 17 bytes in body)
        data: UInt8[0x69,0x6e,0x76,0x61,0x6c,0x69,0x64,0x20,0x64,0x61,0x74,0x61,0x20,0x3a,0x20,0x2d,0x33]
        hdrs: Dict{AbstractString,AbstractString}("Content-Type"=>"text/html; charset=utf-8","Date"=>"Mon, 22 Feb 2016 18:04:15","Content-Language"=>"en","Server"=>"Julia/0.4.3")
    testbinary: Response(404 Not Found, 4 headers, 16 bytes in body)
        data: UInt8[0x69,0x6e,0x76,0x61,0x6c,0x69,0x64,0x20,0x61,0x70,0x69,0x20,0x3a,0x20,0x2d,0x31]
        hdrs: Dict{AbstractString,AbstractString}("Content-Type"=>"text/html; charset=utf-8","Date"=>"Mon, 22 Feb 2016 18:04:15","Content-Language"=>"en","Server"=>"Julia/0.4.3")
ERROR: LoadError: LoadError: test error in expression: (fnresponse(resp))["data"] == arg1 * narg1 + arg2 * narg2
MethodError: `*` has no method matching *(::ASCIIString, ::Dict{AbstractString,Any})
Closest candidates are:
  *(::Any, ::Any, ::Any, ::Any...)
  *(::AbstractString, ::AbstractString...)
 in fnresponse at /root/.julia/v0.4/JuliaWebAPI/src/APIInvoker.jl:60
 in anonymous at test.jl:90
 in do_test at test.jl:50
 [inlined code] from /root/.julia/v0.4/JuliaWebAPI/test/clnt.jl:37
 in anonymous at no file:0
 in fnresponse at /root/.julia/v0.4/JuliaWebAPI/src/APIInvoker.jl:60
 in anonymous at test.jl:90
 in do_test at test.jl:50
 [inlined code] from /root/.julia/v0.4/JuliaWebAPI/test/clnt.jl:37
 in anonymous at no file:0
while loading /root/.julia/v0.4/JuliaWebAPI/test/clnt.jl, in expression starting on line 34
while loading /root/.julia/v0.4/JuliaWebAPI/test/runtests.jl, in expression starting on line 11
=============================================[ ERROR: JuliaWebAPI ]==============================================

failed process: Process(`/usr/bin/julia --check-bounds=yes --code-coverage=none --color=yes /root/.julia/v0.4/JuliaWebAPI/test/runtests.jl`, ProcessExited(1)) [1]

=================================================================================================================
ERROR: JuliaWebAPI had test errors
 in test at pkg/entry.jl:803
 in anonymous at pkg/dir.jl:31
 in cd at file.jl:22
 in cd at pkg/dir.jl:31
 in test at pkg.jl:71

aviks, any pointer?
thanks

@ghost
Copy link

ghost commented Feb 23, 2016

Hi, I revisit the same JuliaWebAPI HttpParser issue using another machine running Ubuntu which has a clean and updated version of HttpParser. It yields the same runtime error as follows (same as in CentOS 7 above).

ERROR (unhandled task failure): MethodError: `call` has no method matching call(::UndefVarError, ::ASCIIString)
Closest candidates are:
  BoundsError()
  BoundsError(::Any...)
  DivideError()
  ...
 in on_error at /root/.julia/v0.4/JuliaWebAPI/src/RESTServer.jl:71
 in on_message_complete at /root/.julia/v0.4/HttpServer/src/HttpServer.jl:406
 in on_message_complete at /root/.julia/v0.4/HttpServer/src/RequestParser.jl:104

Aviks, could you take a look if this is a software bug or not?

Here're the details how I replicated the issue

  1. Use a stable Julia v0.4.3 from https://github.com/tanmaykm/JuliaDockerImages/tree/master/base/v0.4
  2. Install JuliaWebAPI by Pkg.add("JuliaWebAPI"). Validate the installation by running unit test Pkg.test("JuliaWebAPI")
julia> Pkg.test("JuliaWebAPI")
INFO: Testing JuliaWebAPI
WARNING: Method definition info(Any...) in module Base at util.jl:334 overwritten in module Logging at /root/.julia/v0.4/Logging/src/Logging.jl:61.
WARNING: Method definition warn(Any...) in module Base at util.jl:364 overwritten in module Logging at /root/.julia/v0.4/Logging/src/Logging.jl:61.
spawining `/opt/julia_0.4.3/bin/julia /root/.julia/v0.4/JuliaWebAPI/test/srvr.jl`
testing httpresponse...
    testfn1: Response(200 OK, 4 headers, 20 bytes in body)
        data: UInt8[0x7b,0x22,0x64,0x61,0x74,0x61,0x22,0x3a,0x31,0x31,0x2c,0x22,0x63,0x6f,0x64,0x65,0x22,0x3a,0x30,0x7d]
        hdrs: Dict{AbstractString,AbstractString}("Content-Type"=>"application/json; charset=utf-8","Date"=>"Tue, 23 Feb 2016 00:27:13","Content-Language"=>"en","Server"=>"Julia/0.4.3")
    testfn1: Response(200 OK, 4 headers, 2 bytes in body)
        data: UInt8[0x31,0x31]
        hdrs: Dict{AbstractString,AbstractString}("Content-Type"=>"text/html; charset=utf-8","Date"=>"Tue, 23 Feb 2016 00:27:14","Content-Language"=>"en","Server"=>"Julia/0.4.3")
    testbinary: Response(200 OK, 4 headers, 10 bytes in body)
        data: UInt8[0xc8,0x0d,0x47,0x6a,0xf7,0x28,0xcd,0xd4,0x1b,0x1d]
        hdrs: Dict{AbstractString,AbstractString}("Content-Type"=>"application/octet-stream","Date"=>"Tue, 23 Feb 2016 00:27:14","Content-Language"=>"en","Server"=>"Julia/0.4.3")
elapsed time: 0.142470738 seconds
time for 100 calls to testfn1: 0.142470738 secs @ 0.00142470738 per call
elapsed time: 0.048786279 seconds
time for 100 calls to testfn2: 0.048786279 secs @ 0.00048786279 per call
elapsed time: 0.054832114 seconds
time for 100 calls to testbinary: 0.054832114 secs @ 0.00054832114 per call
stopping server process
elapsed time: 1.654991185 seconds
time for 100 calls with remotecall_fetch: 1.654991185 secs @ 0.01654991185 per call
stopped all workers
INFO: JuliaWebAPI tests passed

julia> Pkg.test("HttpParser")
INFO: Testing HttpParser
All assertions passed!
INFO: HttpParser tests passed
  1. Validate the httpparser version if it's new or not (libhttp_parser.so is installed under /root/.julia/v0.4/HttpParser/deps/usr/lib/libhttp_parser.so, which is very different from CentOS 7 (under /usr/lib64).
  2. Run the same JuliaWebAPI REST API example - however, the same errors found
  3. Verify if HttpParser is working well, and re-build it and re-run the same REST API example. same errors found.
julia> Pkg.checkout("HttpParser")
INFO: Checking out HttpParser master...
INFO: Pulling HttpParser latest master...
INFO: No packages to install, update or remove

julia> Pkg.build("HttpParser")
INFO: Building HttpParser

julia> Pkg.test("HttpParser")
INFO: Testing HttpParser
INFO: Recompiling stale cache file /root/.julia/lib/v0.4/HttpParser.ji for module HttpParser.
All assertions passed!
INFO: HttpParser tests passed

Any pointer? appreciate your help. thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants