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

Linux binary of v0.33.0 panicks #814

Closed
beingalink opened this issue Feb 18, 2025 · 8 comments · Fixed by #815
Closed

Linux binary of v0.33.0 panicks #814

beingalink opened this issue Feb 18, 2025 · 8 comments · Fixed by #815
Labels
bug Something isn't working

Comments

@beingalink
Copy link

beingalink commented Feb 18, 2025

Introduction

I just updated the provided linux binary (sqlpage github repository) from v0.32.1 to v0.33.0 and since then I can't run sqlpage anymore as it breaks with following error message:

thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stacker-0.1.18/src/lib.rs:418:13:
assertion `left == right` failed

To Reproduce

Run sqlpage binary without any additional flags.

  • OS: Linux a2f8a 5.10.0-32-amd64 #1 SMP Debian 5.10.223-1 (2024-08-10) x86_64 GNU/Linux
  • Database SQLite
  • SQLPage Version: 0.33.0
@beingalink beingalink added the bug Something isn't working label Feb 18, 2025
@lovasoa
Copy link
Collaborator

lovasoa commented Feb 18, 2025

That's bad ! I cannot reproduce it. Can you run with RUST_BACKTRACE=1 and paste the backtrace here ?

@beingalink
Copy link
Author

Output of RUST_BACKTRACE=full as RUST_BACKTRACE=1 didn't contain any information:

thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stacker-0.1.18/src/lib.rs:418:13:
assertion `left == right` failed
  left: 2
 right: 0
stack backtrace:
   0:     0x5611a8957af9 - <unknown>
   1:     0x5611a8175043 - <unknown>
   2:     0x5611a891f382 - <unknown>
   3:     0x5611a8958b33 - <unknown>
   4:     0x5611a895905b - <unknown>
   5:     0x5611a8958c08 - <unknown>
   6:     0x5611a8958b69 - <unknown>
   7:     0x5611a8958b5c - <unknown>
   8:     0x5611a7f17f8f - <unknown>
   9:     0x5611a7f180bc - <unknown>
  10:     0x5611a7f3921c - <unknown>
  11:     0x5611a7f391ab - <unknown>
  12:     0x5611a87e1b3e - <unknown>
  13:     0x5611a8175043 - <unknown>
  14:     0x5611a88082c0 - <unknown>
  15:     0x5611a8175043 - <unknown>
  16:     0x5611a87e1344 - <unknown>
  17:     0x5611a8175043 - <unknown>
  18:     0x5611a87ecce5 - <unknown>
  19:     0x5611a8175043 - <unknown>
  20:     0x5611a87ec975 - <unknown>
  21:     0x5611a8175043 - <unknown>
  22:     0x5611a87eb605 - <unknown>
  23:     0x5611a8175043 - <unknown>
  24:     0x5611a87f3b21 - <unknown>
  25:     0x5611a8175043 - <unknown>
  26:     0x5611a80a2947 - <unknown>
  27:     0x5611a84753b9 - <unknown>
  28:     0x5611a84724ee - <unknown>
  29:     0x5611a8698c50 - <unknown>
  30:     0x5611a868e34c - <unknown>
  31:     0x5611a86d73d2 - <unknown>
  32:     0x5611a7f780d3 - <unknown>
  33:     0x5611a86d4800 - <unknown>
  34:     0x7f2d7ccf4d7a - __libc_start_main
  35:     0x5611a7f3f7de - <unknown>
  36:                0x0 - <unknown>
Aborted

@lovasoa
Copy link
Collaborator

lovasoa commented Feb 18, 2025

It does contain the actual value returned by pthread_attr_getstack: https://github.com/rust-lang/stacker/blob/04d334ca6ad8ef942fef80e173c6e34bbb905a6a/src/lib.rs#L418C30-L418C51

A return value of 2 (ENOENT) is strange and really unexpected.

In the meantime, here is a build without the bug inducing dependency: sqlpage.bin.gz. Can you confirm it fixes the issue for you ?

But I'd like to get to the bottom of this.

@beingalink
Copy link
Author

This is on a really restricted linux system with heavily reduced access to the system environment and quite low memory/cpu resources (basically it's managed hosting with ssh access as a goodie). I wouldn't have posted a bug if it didn't work before as my expectancy for this to work there was originally quite low. To my surprise, it worked a lot better than expected, at least enough to experiment. For production, I'd use a different system with more resources and fewer restrictions. :)

@lovasoa
Copy link
Collaborator

lovasoa commented Feb 18, 2025

Do you have an idea how we could reproduce this restricted environment locally ? That would help ! stacker is a popular crate in the rust ecosystem, with 17M downloads, so the issue probably affects much more than just sqlpage. Even on a restricted environment, crashing with a cryptic error message is not a desirable behavior.

@beingalink
Copy link
Author

Unfortunately, I don't know how to emulate this specific environment and I'm not really linux savvy. The hoster is netcup and the plan is Webhosting 2000 (https://www.netcup.com/en/hosting).

Unfortunately, the fixed binary you posted doesn't work because it doesn't seem to be statically linked to glibc:

./sqlpage.bin: /lib/libc.so.6: version `GLIBC_2.34' not found (required by ./sqlpage.bin)

@lovasoa
Copy link
Collaborator

lovasoa commented Feb 18, 2025

Ok, the ENOENT (2) error code and your message put me on the right path, I can reproduce it now !

❯ sudo mount -t tmpfs none /proc

❯ ./sqlpage.bin
thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/stacker-0.1.18/src/lib.rs:418:13:
assertion `left == right` failed
  left: 2
 right: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

In the same environment, sqlpage without the stacker dependency works fine. I reported the issue to stacker, so that they can hopefully fix it: rust-lang/stacker#115

In the meantime, you can use the following statically linked binary: sqlpage.bin.gz

@beingalink
Copy link
Author

Thank you! This binary works fine. :)

lovasoa added a commit to lovasoa/stacker that referenced this issue Feb 18, 2025
lovasoa added a commit that referenced this issue Feb 18, 2025
* update deps

* Disable stack growing in sqlparser

Fixes #814 ?
nagisa pushed a commit to rust-lang/stacker that referenced this issue Feb 21, 2025
* improve error handling

see #115

See sqlpage/SQLPage#814

* improve error message in destroy_pthread_attr

* remove code duplication

* cleanup code and add comments

* Make error handling code easier to read

* update formatting

https://github.com/rust-lang/stacker/pull/116/files#r1961535064

* put the beautiful unicode apostrophe back

https://github.com/rust-lang/stacker/pull/116/files#r1961536979

* use one file per guess_os_stack_limit implementation

* fix error handling on openbsd too

* beautiful unicode apostrophe

* format

* fix windows build

* remove unused unsafe

* fix error handling on windows

VirtualQuery is a faillible function that was treated as infaillible
https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualquery

* SetThreadStackGuarantee can also error on windows

* simplify pthread error handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants