anmonteiro / ocaml-h2

An HTTP/2 implementation written in pure OCaml
BSD 3-Clause "New" or "Revised" License
309 stars 31 forks source link

Tests don't work on `4.11.0+32bit` #150

Closed dinosaure closed 2 years ago

dinosaure commented 3 years ago

In our CI, we systematically test our libraries on 32bit platform (for ESP32 and ARM 32) and it seems that h2 does not work properly on such platform. Failures are reproducible with a simple switch to 4.11.0+32bit. From what I know, we don't reach the initial reader state on the Client_connection implementation - so, paf currently stuck on the loop only on 32bit platform (see this log of a cancelled job).

anmonteiro commented 3 years ago

I can't spot the h2 failure. Is there a better log or stack trace somewhere?

dinosaure commented 3 years ago

This is the output with 4.11.0+32bit and a696a1c

     test_h2 alias lib_test/runtest
Testing `ocaml-h2 unit tests'.
This run has ID `B7468293-E299-4A60-B7FB-7CAE8E43D46C'.

  [OK]          headers          0   roundtripping.
  [OK]          headers          1   test remove.
  [OK]          headers          2   test replace.

Full test results in `~/dev/ocaml-h2/_build/default/lib_test/_build/_tests/ocaml-h2 unit tests'.
Test Successful in 0.000s. 3 tests run.
test_priority alias lib_test/runtest
Testing `httpaf unit tests'.
This run has ID `CA6818DE-625D-4764-961E-448E960A37BF'.

  [OK]          Reprioritization tests          0   Reprioritize simple.
  [OK]          Reprioritization tests          1   Reprioritize simple exclu...
  [OK]          Reprioritization tests          2   Reprioritize to dependency.
  [OK]          Reprioritization tests          3   Reprioritize to dependenc...
  [OK]          Priority_Queue_Tests            0   Priority queue tests.

Full test results in `~/dev/ocaml-h2/_build/default/lib_test/_build/_tests/httpaf unit tests'.
Test Successful in 0.001s. 5 tests run.
 test_frames alias lib_test/runtest (exit 2)
(cd _build/default/lib_test && ./test_frames.exe)
Fatal error: exception Sys_error("http2-frame-test-case: No such file or directory")
test_h2_client alias lib_test/runtest (exit 1)
(cd _build/default/lib_test && ./test_h2_client.exe)
Testing `ocaml-h2 unit tests'.
This run has ID `9A98671A-7822-48DA-A04E-3F82434021A0'.

> [FAIL]        client_connection          0   initial reader state.
  [FAIL]        client_connection          1   set up client connection.
  [FAIL]        client_connection          2   invalid connection preface fro...
  [FAIL]        client_connection          3   invalid connection preface fro...
  [FAIL]        client_connection          4   simple GET request.
  [FAIL]        client_connection          5   data larger than declared.
  [FAIL]        client_connection          6   stream error on idle stream.
  [FAIL]        client_connection          7   continuation frame (success).
  [FAIL]        client_connection          8   stream correctly transitions s...
  [FAIL]        client_connection          9   continuation frame on another ...
  [FAIL]        client_connection         10   push handler successful response.
  [FAIL]        client_connection         11   push handler cancels push.
  [FAIL]        client_connection         12   ping.
  [FAIL]        client_connection         13   stream level error handler cal...
  [FAIL]        client_connection         14   starting an h2c connection.
  [FAIL]        client_connection         15   non-zero `content-length` and ...
  [FAIL]        client_connection         16   premature remote close with pe...
  [FAIL]        client_connection         17   request, server sends RST_STRE...
  [FAIL]        client_connection         18   request, server sends RST_STRE...
  [FAIL]        client_connection         19   test connection shutdown.
  [FAIL]        client_connection         20   reading the response body as i...
  [FAIL]        client_connection         21   flow control.
  [FAIL]        client_connection         22   flow control -- can send empty...

┌──────────────────────────────────────────────────────────────────────────────┐
│ [FAIL]        client_connection          0   initial reader state.           │
└──────────────────────────────────────────────────────────────────────────────┘
[exception] File "lib/client_connection.ml", line 188, characters 4-10: Assertion failed

Logs saved to `~/dev/ocaml-h2/_build/default/lib_test/_build/_tests/ocaml-h2 unit tests/client_connection.000.output'.
 ──────────────────────────────────────────────────────────────────────────────

Full test results in `~/dev/ocaml-h2/_build/default/lib_test/_build/_tests/ocaml-h2 unit tests'.
23 failures! in 0.005s. 23 tests run.
test_h2_server alias lib_test/runtest (exit 1)
(cd _build/default/lib_test && ./test_h2_server.exe)
Testing `ocaml-h2 unit tests'.
This run has ID `521BB479-49C2-4DA8-A1A7-D60560ABBF4B'.

  [OK]          server_connection          0   initial reader state.
  [OK]          server_connection          1   shutdown reader closed.
> [FAIL]        server_connection          2   malformed frame.
  [FAIL]        server_connection          3   malformed frame.
  [FAIL]        server_connection          4   malformed frame.
  [FAIL]        server_connection          5   send frames after a padded frame.
  [FAIL]        server_connection          6   continuation frame on the same...
  [FAIL]        server_connection          7   continuation frame on another ...
  [FAIL]        server_connection          8   frame size error (frame size e...
  [FAIL]        server_connection          9   frame size error on a priority...
  [FAIL]        server_connection         10   connection preface read with m...
  [OK]          server_connection         11   settings that exceeds the maxi...
  [FAIL]        server_connection         12   open existing stream.
  [FAIL]        server_connection         13   dependent stream.
  [FAIL]        server_connection         14   server push.
  [FAIL]        server_connection         15   CONNECT method.
  [FAIL]        server_connection         16   CONNECT method (malformed).
  [FAIL]        server_connection         17   Client sends 0 max concurrent ...
  [FAIL]        server_connection         18   empty fixed streaming response.
  [FAIL]        server_connection         19   starting an h2c connection.
  [FAIL]        server_connection         20   non-zero `content-length` and ...
  [FAIL]        server_connection         21   premature remote close with pe...
  [FAIL]        server_connection         22   frame size error unknown frame.
  [FAIL]        server_connection         23   reading the request body as it...
  [FAIL]        server_connection         24   flow control.
  [FAIL]        server_connection         25   flow control -- can send empty...
  [FAIL]        server_connection         26   trailers.

┌──────────────────────────────────────────────────────────────────────────────┐
│ [FAIL]        server_connection          2   malformed frame.                │
└──────────────────────────────────────────────────────────────────────────────┘
[exception] File "lib/server_connection.ml", line 186, characters 4-10: Assertion failed

Logs saved to `~/dev/ocaml-h2/_build/default/lib_test/_build/_tests/ocaml-h2 unit tests/server_connection.002.output'.
 ──────────────────────────────────────────────────────────────────────────────

Full test results in `~/dev/ocaml-h2/_build/default/lib_test/_build/_tests/ocaml-h2 unit tests'.
24 failures! in 0.006s. 27 tests run.
anmonteiro commented 3 years ago

Got it. Most of these just look like the submodules weren't pulled.

I'll look at the assertion failure though.

anmonteiro commented 3 years ago

Oh this is great. The assertion is there for 32-bit system too! :D

I'll get to this soon, but first I need to figure out how to get a 32-bit system.

EduardoRFS commented 3 years ago

@anmonteiro use a Linux box or docker on macOS to be able to run 32bits code. With esy you can do the resolution below to force 32bits.

{
  "resolutions": {
    "ocaml": {
      "source": "esy-ocaml/ocaml#dd66cad318e04c7f2c753f8ce2fd8851e975f89a",
      "override": {
        "build": [
          "./esy-configure --prefix $cur__install --build=x86_64-pc-linux-gnu --host=i386-linux CC='gcc -m32' AS='as --32' ASPP='gcc -m32 -c' PARTIALLD='ld -r -melf_i386'",
          "./esy-build"
        ]
      }
    }
  }
}