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

chore: improve error message for fsevents failure #6206

Conversation

rgrinberg
Copy link
Member

Include the problematic event flags in the error message

Signed-off-by: Rudi Grinberg [email protected]

ps-id: 7ab84709-6af3-433e-b337-843610bd4119

@rgrinberg rgrinberg force-pushed the ps/rr/chore__improve_error_message_for_fsevents_failure branch from baaa89d to d6a2798 Compare October 10, 2022 16:32
@rgrinberg rgrinberg requested a review from Alizter October 10, 2022 16:32
Copy link
Collaborator

@Alizter Alizter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me, but do we have a way to test it?

@rgrinberg
Copy link
Member Author

I'm unable to write a test unfortunately. If I were able to write a test, I'd be able to reproduce a bug. Instead, I'm relying on @samoht to help out with triaging the issue with the help of this PR.

@samoht
Copy link
Member

samoht commented Oct 11, 2022

This actually makes the error message worst :-)

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x3)
  * frame #0: 0x00000001a01ce638 libsystem_c.dylib`__vfprintf + 344
    frame #1: 0x00000001a01fd764 libsystem_c.dylib`_vsnprintf + 224
    frame #2: 0x00000001a01d9aa8 libsystem_c.dylib`__sprintf_chk + 60
    frame #3: 0x000000010032c2f0 dune`dune_fsevents_action(v_flags=<unavailable>) at fsevents_stubs.c:291:19 [opt]
    frame #4: 0x000000010034a934 dune`caml_c_call + 28
    frame #5: 0x00000001001f3120 dune`camlFsevents__action_659 + 24
    frame #6: 0x00000001001f0c84 dune`camlDune_file_watcher__fsevents_standard_event_2707 + 20
    frame #7: 0x00000001002a3614 dune`camlStdune__list__loop_481 + 76
    frame #8: 0x00000001001e6eac dune`camlDune_engine__scheduler__iter_3770 + 188
    frame #9: 0x0000000100269b30 dune`camlFiber__code_begin + 56
    frame #10: 0x00000001001e744c dune`camlDune_engine__scheduler__run_3798 + 172
    frame #11: 0x00000001001e7768 dune`camlDune_engine__scheduler__run_and_cleanup_3925 + 16
    frame #12: 0x00000001001e93a0 dune`camlDune_engine__scheduler__fun_5934 + 392
    frame #13: 0x00000001002b1148 dune`camlCmdliner_term__fun_633 + 112
    frame #14: 0x00000001002abf7c dune`camlCmdliner_eval__run_parser_537 + 44
    frame #15: 0x00000001002ad0cc dune`camlCmdliner_eval__eval_value_inner_1711 + 580
    frame #16: 0x000000010000c408 dune`camlMain__entry + 1512
    frame #17: 0x00000001000055e4 dune`caml_program + 13452
    frame #18: 0x000000010034a9a4 dune`caml_start_program + 104
    frame #19: 0x000000010032cd44 dune`caml_startup_common + 612
    frame #20: 0x000000010032cd8c dune`caml_startup + 16
    frame #21: 0x000000010032cdf0 dune`main + 16
    frame #22: 0x0000000100a7908c dyld`start + 520

instead of:

Error: exception Failure("fsevents: unexpected event action")
Raised by primitive operation at Fsevents.Event.action in file
  "src/fsevents/fsevents.ml", line 204, characters 17-31
Called from Dune_file_watcher.fsevents_standard_event in file
  "src/dune_file_watcher/dune_file_watcher.ml", line 507, characters 15-42
Called from Stdune__list.filter_map.loop in file "otherlibs/stdune/list.ml",
  line 19, characters 12-15
Called from Dune_engine__scheduler.Run_once.iter in file
  "src/dune_engine/scheduler.ml", line 1044, characters 19-25
Called from Fiber.run.loop in file "src/fiber/fiber.ml", line 15, characters
  51-60
Called from Fiber.run.(fun) in file "src/fiber/fiber.ml" (inlined), line 17,
  characters 17-47
Called from Dune_engine__scheduler.Run_once.run in file
  "src/dune_engine/scheduler.ml", line 1122, characters 10-50
Re-raised at Stdune__exn.raise_with_backtrace in file
  "otherlibs/stdune/exn.ml" (inlined), line 36, characters 27-56
Called from Dune_engine__scheduler.Run.go.(fun) in file
  "src/dune_engine/scheduler.ml", line 1358, characters 30-61
Called from Cmdliner_term.app.(fun) in file
  "vendor/cmdliner/src/cmdliner_term.ml", line 25, characters 19-24
Called from Cmdliner.Term.run in file "vendor/cmdliner/src/cmdliner.ml", line
  117, characters 32-39
Called from Cmdliner.Term.term_eval in file
  "vendor/cmdliner/src/cmdliner.ml", line 147, characters 18-36
Called from Cmdliner.Term.Group.eval in file
  "vendor/cmdliner/src/cmdliner.ml", line 367, characters 22-48
Called from Main in file "bin/main.ml", line 91, characters 10-50

@emillon
Copy link
Collaborator

emillon commented Oct 11, 2022

This one is sprintf segfaulting because it's attempting to write on the format string.

@emillon
Copy link
Collaborator

emillon commented Oct 11, 2022

@samoht can you try with #6215 ? that's probably unrelated but curious to check if it is.

@samoht
Copy link
Member

samoht commented Oct 11, 2022

With #6215 I just get:

Error: exception Failure("fsevents: unexpected event action")
Raised by primitive operation at Fsevents.Event.action in file
  "src/fsevents/fsevents.ml", line 204, characters 17-31
Called from Dune_file_watcher.fsevents_standard_event in file
  "src/dune_file_watcher/dune_file_watcher.ml", line 517, characters 15-42
Called from Stdune__list.filter_map.loop in file "otherlibs/stdune/list.ml",
  line 19, characters 12-15
Called from Dune_engine__scheduler.Run_once.iter in file
  "src/dune_engine/scheduler.ml", line 1053, characters 19-25
Called from Fiber.run.loop in file "src/fiber/fiber.ml", line 15, characters
  51-60
Called from Fiber.run.(fun) in file "src/fiber/fiber.ml" (inlined), line 17,
  characters 17-47
Called from Dune_engine__scheduler.Run_once.run in file
  "src/dune_engine/scheduler.ml", line 1131, characters 10-50
Re-raised at Stdune__exn.raise_with_backtrace in file
  "otherlibs/stdune/exn.ml" (inlined), line 36, characters 27-56
Called from Dune_engine__scheduler.Run.go.(fun) in file
  "src/dune_engine/scheduler.ml", line 1367, characters 30-61
Called from Cmdliner_term.app.(fun) in file
  "vendor/cmdliner/src/cmdliner_term.ml", line 24, characters 19-24
Called from Cmdliner_eval.run_parser in file
  "vendor/cmdliner/src/cmdliner_eval.ml", line 34, characters 37-44
Called from Cmdliner_eval.eval_value in file
  "vendor/cmdliner/src/cmdliner_eval.ml", line 202, characters 14-39
Called from Main in file "bin/main.ml", line 91, characters 10-41

I must not crash.  Uncertainty is the mind-killer. Exceptions are the
little-death that brings total obliteration.  I will fully express my cases.
Execution will pass over me and through me.  And when it has gone past, I
will unwind the stack along its path.  Where the cases are handled there will
be nothing.  Only I will remain.

@rgrinberg rgrinberg force-pushed the ps/rr/chore__improve_error_message_for_fsevents_failure branch from d6a2798 to fde494a Compare October 11, 2022 15:14
@rgrinberg rgrinberg requested a review from emillon October 11, 2022 15:15
@rgrinberg
Copy link
Member Author

@samoht could you try again? Should be good

src/fsevents/fsevents_stubs.c Outdated Show resolved Hide resolved
src/fsevents/fsevents_stubs.c Outdated Show resolved Hide resolved
@rgrinberg rgrinberg force-pushed the ps/rr/chore__improve_error_message_for_fsevents_failure branch 2 times, most recently from 5c1af64 to 2cbda58 Compare October 11, 2022 15:20
Include the problematic event flags in the error message

Signed-off-by: Rudi Grinberg <[email protected]>

ps-id: 7ab84709-6af3-433e-b337-843610bd4119
@rgrinberg rgrinberg force-pushed the ps/rr/chore__improve_error_message_for_fsevents_failure branch from 2cbda58 to bfb9407 Compare October 11, 2022 15:27
@samoht
Copy link
Member

samoht commented Oct 11, 2022

Seems better:

Error: exception Failure("fsevents: unexpected event action 3")

@rgrinberg rgrinberg closed this Oct 19, 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

Successfully merging this pull request may close these issues.

4 participants