Skip to content

Test failure in EventStream SSE #5

Description

@kolbma

Description

While the test response::stream::sse::sse_tests::test_heartbeat is repeated multiple times in the test garnish and has been always successful, I got now one time an assertion failed.

Is anybody of you using EventStream SSE of Rocket and has seen any inexplicable outputs??!!

The result of the test looks like a memory corruption or a race in setting memory boundaries:

failures:

---- response::stream::sse::sse_tests::test_heartbeat stdout ----
thread 'response::stream::sse::sse_tests::test_heartbeat' panicked at 'assertion failed: `(left == right)`
  left: `"data:hello\n:\n\n\n"`,
 right: `"data:hello\n\n"`', core/lib/src/response/stream/sse.rs:795:9


failures:
    response::stream::sse::sse_tests::test_heartbeat

test result: FAILED. 64 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.06s

https://github.com/kolbma/Rocket/blob/e365ab9ba423cf90864749318b548731ee9dc8d3/core/lib/src/response/stream/sse.rs#L792-L795

To Reproduce

cd core/lib
c=0; rc=0 ; while [ "$rc" -eq 0 ] ; do cargo +stable test response::stream::sse::sse_tests::test_heartbeat ; rc=$? ; c=$((c+1)) ; done ; echo "Failed after run $c"

Failed after run 7 or Failed after run 79.
But fails always if you try it often enough.

Expected Behavior

Test response::stream::sse::sse_tests::test_heartbeat should never fail.

Environment:

:: Preparing. Environment is...
  CARGO VERSION: cargo 1.58.0 (7f08ace4f 2021-11-24)
  RUSTC VERSION: rustc 1.58.0 (02072b482 2022-01-11)
  ROCKET VERSION: 0.5.0-rc.2

Additional Context

Need to stress test this some more.

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