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

Weird case clause using OTP master with binary data from a NIF #9304

Open
essen opened this issue Jan 15, 2025 · 0 comments
Open

Weird case clause using OTP master with binary data from a NIF #9304

essen opened this issue Jan 15, 2025 · 0 comments
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@essen
Copy link
Contributor

essen commented Jan 15, 2025

Describe the bug
On CI using OTP master I occasionally get the following:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rfc9114_SUITE:do_receive_response failed on line 2400
Reason: {case_clause,<<>>}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

https://github.com/ninenines/cowboy/actions/runs/12768790159/job/35643757234?pr=1658#step:5:1309

But line 2400 is as follow:

	Body = case Rest of
		<<>> ->
			<<>>;
		<<
			0, %% DATA frame.
			DLenEnc:2, DLen:DLenBits,
			Body0:DLen/bytes
		>> ->
			BodyLen = integer_to_binary(byte_size(Body0)),
			Body0
	end,

https://github.com/ninenines/cowboy/blob/master/test/rfc9114_SUITE.erl#L2400-L2410

So I don't think it should give a case clause.

Note however that the binary data is sent from a NIF (quicer) so perhaps that impacts things. However only seems to happen like this on master, and only in this case block (the binary received gets parsed properly earlier, only when looking at the Rest does it lead to a case clause).

To Reproduce
Other than cloning Cowboy and running make ct-rfc9114 COWBOY_QUICER=1 I'm not sure, but even then it might not always happen.

Expected behavior
I don't expect a case clause there.

Affected versions
OTP master.

Additional context
Please provide guidance to better investigate the problem.

@essen essen added the bug Issue is reported as a bug label Jan 15, 2025
@bjorng bjorng self-assigned this Jan 16, 2025
@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Jan 16, 2025
jhogberg added a commit to jhogberg/otp that referenced this issue Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

3 participants