zedeus / nitter

Alternative Twitter front-end
https://nitter.net
GNU Affero General Public License v3.0
10.05k stars 533 forks source link

Openning a user profile leads to a bus error #341

Open kdltr opened 3 years ago

kdltr commented 3 years ago

Trying to run Nitter on Alpine Linux armhf, with Nim compiled from source the same day (Nim Compiler Version 1.4.2 [Linux: arm]) Nitter seems to be working at first, but when I browse to a user profile, it crashes with a bus error. Here’s the backtrace from the core file:

#0  0x0056f464 in emitLiteral__bNsFv8RFni7H9bEPE9csAUSA ()
#1  0x0056f738 in compressFragment__UIYOGxv54fqicvKvwtiyPw ()
#2  0x7ebf4550 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
ghost commented 3 years ago

Same here on a Raspberrypi 4b running raspbian (compiled with nim compiler version 1.5.1). Did you find any solution in the meantime?

mdik commented 3 years ago

I had the same issues, and compiling with nimble build -y -d:release --opt:size --os:linux --gc:arc fixed it for me!

(i think it's the --gc:arc that does the job, but the other parameters don't hurt as well :shrug:

mdik commented 3 years ago

PS: I still get bus error when I click the "load more" button on the bottom of a user page.

mdik commented 3 years ago

I ran the build again with -d:checkAbi and it gave some errors regarding types:

/usr/lib/nim/pure/asyncstreams.nim(58, 13) Warning: ':env.future2.cb = (named, :env)' creates an uncollectable ref cycle; annotate 'future2' with .cursor [CycleCreated]                                                                                                      In file included from /home/nitter/.cache/nim/nitter_d/stdlib_os.nim.c:12:                                                             /usr/lib/nim/nimbase.h:271:35: error: static assertion failed: "backend & Nim disagree on size for: Dev{int} [declared in /usr/lib/nim/posix/posix_other.nim(153, 3)]"                                                                                                          271 | #define NIM_STATIC_ASSERT(x, msg) _Static_assert((x), msg)
      |                                   ^~~~~~~~~~~~~~
/home/nitter/.cache/nim/nitter_d/stdlib_os.nim.c:174:1: note: in expansion of macro ‘NIM_STATIC_ASSERT’
  174 | NIM_STATIC_ASSERT(sizeof(dev_t) == 4, "backend & Nim disagree on size for: Dev{int} [declared in /usr/lib/nim/posix/posix_other
.nim(153, 3)]");
      | ^~~~~~~~~~~~~~~~~
/usr/lib/nim/nimbase.h:271:35: error: static assertion failed: "backend & Nim disagree on size for: Off{int64} [declared in /usr/lib/ni
m/posix/posix_other.nim(168, 3)]" 
  271 | #define NIM_STATIC_ASSERT(x, msg) _Static_assert((x), msg)
      |                                   ^~~~~~~~~~~~~~
/home/nitter/.cache/nim/nitter_d/stdlib_os.nim.c:180:1: note: in expansion of macro ‘NIM_STATIC_ASSERT’
  180 | NIM_STATIC_ASSERT(sizeof(off_t) == 8, "backend & Nim disagree on size for: Off{int64} [declared in /usr/lib/nim/posix/posix_oth
er.nim(168, 3)]");
      | ^~~~~~~~~~~~~~~~~
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -Os -fno-ident   -I/usr/lib/nim -I/home/nitter/nitter/src -
o /home/nitter/.cache/nim/nitter_d/stdlib_os.nim.c.o /home/nitter/.cache/nim/nitter_d/stdlib_os.nim.c' failed with exit code: 1

Sorry for the messy formatting...

mdik commented 2 years ago

i found what causes the issue. i compiled with -d:strip, and the errors pointed me towards https://github.com/zedeus/nitter/blob/25191f7c40efaa563d098092d04d6290affe28ba/src/formatters.nim#L25

after reverting the function to before https://github.com/zedeus/nitter/commit/2a2255d75ac5f67244064360fa42875c0ef19539 it works much better. now it sometimes appears to time out, but one has the opportunity to view a user profile before that happens.

i also compiled it with some of https://github.com/jackyzy823 's pull requests which seem to work fine!

zedeus commented 2 years ago

Is this still an issue?

Missingmew commented 2 years ago

After commenting on #316 I discovered this issue. I would say theyre the same, if not related to each other (same platform, same kind of issue with bus error). I followed the hints that @mdik mentioned but even when reverting stripHtml to the older version I still get reliable crashes.

mdik commented 2 years ago

After compiling latest main branch with nim 1.6.2, I have no crashes on user pages anymore. Thank you!

(Now the proxy setting that I merged from the pull request seems to not work anymore, but that might be due to Tor, and I'll open another issue if this persists.)

zedeus commented 2 years ago

Good to hear, let me know if the issue is still there with master compiled with Nim 1.6.2 @Missingmew @girlwithnoname @kdltr

Missingmew commented 2 years ago

I just recompiled using 9a578b3 and nim 1.6.2 and still get a crash when attempting to visit a user profile, so it doesnt seem to be completely gone just yet.

Missingmew commented 2 years ago

Ive been rebuilding nitter every so often to try and see if this bug persists. Even after getting nim 1.6.4 visiting a user profile crashes nitter. Is this possibly an issue with nim itself instead of just nitter? I unfortunately havent had the time to debug this in any more detail.

mdik commented 2 years ago

I've got an armbian with nim 1.6.2 and fortunately still no problems anymore. I know, not incredibly helpful information, but maybe a little in terms of where to look, and where not :-/