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

Uncaught exception "broken pipe" #346

Open
frangio opened this issue Aug 2, 2022 · 1 comment
Open

Uncaught exception "broken pipe" #346

frangio opened this issue Aug 2, 2022 · 1 comment

Comments

@frangio
Copy link

frangio commented Aug 2, 2022

Describe the bug

Piping the output of comby to tools like head results in an uncaught exception I guess because stdout is closed early. Another example is piping to less.

The console output is pretty gnarly because of multiple threads I suppose (running this on a large number of files).

Console output
(Sys_error "Broken pipe")
Raised at Stdlib__string.index_rec in file "string.ml", line 115, characters 19-34
Called from Sexplib0__Sexp.Printing.index_of_newline in file "src/sexp.ml", line 113, characters 13-47
(Sys_error "Broken pipe")
Raised at Stdlib__string.index_rec in file "string.ml", line 115, characters 19-34
Called from Sexplib0__Sexp.Printing.index_of_newline in file "src/sexp.ml", line 113, characters 13-47
Uncaught exception:

  (Sys_error "Broken pipe")

Raised by primitive operation at Stdlib__format.formatter_of_out_channel.(fun) in file "format.ml", line 1000, characters 50-58
Called from Stdlib__format.flush_standard_formatters in file "format.ml", line 1378, characters 2-33
Called from Stdlib.at_exit.(fun) in file "stdlib.ml", line 553, characters 62-65
Called from Stdlib.do_at_exit in file "stdlib.ml" (inlined), line 556, characters 20-39
Called from Stdlib.exit in file "stdlib.ml", line 559, characters 2-15
Called from Daemon.check_entry_point in file "src/utils/daemon.ml", line 287, characters 4-26
Uncaught exception:

  Worker.Worker_exited_abnormally(12814, _)

Raised by primitive operation at Base__Exn.handle_uncaught_aux in file "src/exn.ml", line 111, characters 6-10
(Sys_error "Broken pipe")
Raised at Stdlib__string.index_rec in file "string.ml", line 115, characters 19-34
Called from Sexplib0__Sexp.Printing.index_of_newline in file "src/sexp.ml", line 113, characters 13-47
(Sys_error "Broken pipe")
Raised at Stdlib__string.index_rec in file "string.ml", line 115, characters 19-34
Called from Sexplib0__Sexp.Printing.index_of_newline in file "src/sexp.ml", line 113, characters 13-47
Uncaught exception:

  (Sys_error "Broken pipe")

Raised by primitive operation at Stdlib__format.formatter_of_out_channel.(fun) in file "format.ml", line 1000, characters 50-58
Called from Stdlib__format.flush_standard_formatters in file "format.ml", line 1378, characters 2-33
Called from Stdlib.at_exit.(fun) in file "stdlib.ml", line 553, characters 62-65
Called from Stdlib.do_at_exit in file "stdlib.ml" (inlined), line 556, characters 20-39
Called from Stdlib.exit in file "stdlib.ml", line 559, characters 2-15
Called from Daemon.check_entry_point in file "src/utils/daemon.ml", line 287, characters 4-26
(Sys_error "Broken pipe")
Raised at Stdlib__string.index_rec in file "string.ml", line 115, characters 19-34
Called from Sexplib0__Sexp.Printing.index_of_newline in file "src/sexp.ml", line 113, characters 13-47
(Sys_error "Broken pipe")
Raised at Stdlib__string.index_rec in file "string.ml", line 115, characters 19-34
Called from Sexplib0__Sexp.Printing.index_of_newline in file "src/sexp.ml", line 113, characters 13-47
Uncaught exception:

  (Sys_error "Broken pipe")

Raised by primitive operation at Stdlib__format.formatter_of_out_channel.(fun) in file "format.ml", line 1000, characters 50-58
Called from Stdlib__format.flush_standard_formatters in file "format.ml", line 1378, characters 2-33
Called from Stdlib.at_exit.(fun) in file "stdlib.ml", line 553, characters 62-65
Called from Stdlib.do_at_exit in file "stdlib.ml" (inlined), line 556, characters 20-39
Called from Stdlib.exit in file "stdlib.ml", line 559, characters 2-15
Called from Daemon.check_entry_point in file "src/utils/daemon.ml", line 287, characters 4-26
(Sys_error "Broken pipe")
Raised at Stdlib__string.index_rec in file "string.ml", line 115, characters 19-34
Called from Sexplib0__Sexp.Printing.index_of_newline in file "src/sexp.ml", line 113, characters 13-47
(Sys_error "Broken pipe")
Raised at Stdlib__string.index_rec in file "string.ml", line 115, characters 19-34
Called from Sexplib0__Sexp.Printing.index_of_newline in file "src/sexp.ml", line 113, characters 13-47
Uncaught exception:

  (Sys_error "Broken pipe")

Raised by primitive operation at Stdlib__format.formatter_of_out_channel.(fun) in file "format.ml", line 1000, characters 50-58
Called from Stdlib__format.flush_standard_formatters in file "format.ml", line 1378, characters 2-33
Called from Stdlib.at_exit.(fun) in file "stdlib.ml", line 553, characters 62-65
Called from Stdlib.do_at_exit in file "stdlib.ml" (inlined), line 556, characters 20-39
Called from Stdlib.exit in file "stdlib.ml", line 559, characters 2-15
Called from Daemon.check_entry_point in file "src/utils/daemon.ml", line 287, characters 4-26

Reproducing

Just run comby and pipe the output to head ($ comby ... | head). The result should be longer than 10 lines so that head closes the output pipe before all results are returned.

Additional context

Piping to head is very useful to iterate on a query.

@rvantonder
Copy link
Member

Thanks for the report, I can reproduce. My first idea was to try -sequential so there aren't multiple writes to stdout but that still doesn't help. Will investigate

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

No branches or pull requests

2 participants