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
Cannot print backtraces within a fiber #76
Comments
|
Hi! I'd love to have some time to review and understand this. I've been too busy at work and no time for Guile lately |
|
It sounds to me like stack maps are somehow at fault here. I have seen some backtrace-printing problems. But unless I misunderstand, it's not a fibers bug. Unfortunately the original report doesn't repro for me! |
|
Hmm, that's a bummer. Well, I took another look at this issue and I have a new reproducer that doesn't involve backtraces or stack frames at all. (use-modules (fibers)
(fibers conditions)
(fibers scheduler))
(define done? (make-condition))
(run-fibers
(lambda ()
(spawn-fiber
(lambda ()
(pk (current-scheduler)) ; does not terminate for me :(
(signal-condition! done?)))
(wait done?)))There is circularity in the scheduler object and this program just prints endlessly until I kill it. I ran this program against Guile built from main and fibers built from master to make sure I could still reproduce it using the freshest code. Can anyone else reproduce this? I guess it's a bug with cycle detection in Guile's printer? I don't know how to explain why this bug would happen for me but not others. |
Yeah, I see the same behavior. Also, with the original reproducer you posted, it doesn't hang forever for me, but does pause for quite a few seconds at the point you indicated, which could be because it's getting stuck trying to print the scheduler record. Maybe a quick way to avoid this to set a custom printer for the scheduler record? #82 |
|
Printers should be better certainly. But the backtrace code should probably abort when it has enough characters, instead of truncating the string result to the available characters. |
|
How many cores do you have @cbaines? I wonder if mine prints for so much longer because I have 20 cores. So how do these next steps sound?
|
I was testing on a machine with 8 cores, but I'm think I'm having this problem acutely on a machine with 32, so you're probably right that cores makes the problem worse. |
|
Regarding backtraces and circular data structures, the |
|
So the hang is the circular data structure printing that is fixed in wip-custom-ports, AFAIU. But the other part of this bug is the COLUMNS error. Minimal reproducer: (with-exception-handler
(lambda (e)
(catch #t
(lambda () (error "bar"))
(lambda args #f))
(error "qux"))
(lambda () (error "foo")))Expected result is a backtrace in the REPL at the |
|
@wingo Yeah! That's exactly the behavior I was seeing. Strange, huh? |
|
I know why :) working on a fix... |
|
Fixed in Will merge to Guile soon. |
At Spritely we've been experiencing a strange issue with fibers >= 1.1.0 where we cannot print backtraces for errors that we catch within a fiber. Below is a reproducer program. This program should catch an error and display a backtrace:
(use-modules (fibers) (fibers conditions) (ice-9 control)) (run-fibers (lambda () (spawn-fiber (lambda () (call/ec (lambda (abort) (with-exception-handler (lambda (e) (setenv "COLUMNS" "72") (display-backtrace (make-stack #t) (current-error-port)) (abort)) (lambda () (error "oops"))))))) (wait (make-condition))))However, instead it hangs after printing a partial backtrace:
The CPU running the program then goes to 100% usage. It always hangs on the
fibers/scheduler.scmstack frame.Interestingly, reverting commit 84addfb resolves the issue.
Bonus: You might be wondering why
(setenv "COLUMNS" "72")is in the code above. It's because otherwise we encounter what seems to be a bug in Guile:This is a weird one!
The text was updated successfully, but these errors were encountered: