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

Test failure in EventStream SSE #5

Closed
kolbma opened this issue Jan 24, 2022 · 1 comment
Closed

Test failure in EventStream SSE #5

kolbma opened this issue Jan 24, 2022 · 1 comment

Comments

@kolbma
Copy link

kolbma commented Jan 24, 2022

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.

@kolbma
Copy link
Author

kolbma commented Jan 24, 2022

Looks like multiple events will be mixed up in the special handling of Rocket for \r and \n.

kolbma added a commit to kolbma/Rocket that referenced this issue Jan 24, 2022
@kolbma kolbma closed this as completed Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant