Giter VIP home page Giter VIP logo

polyphony's People

Contributors

codekitchen avatar dezza avatar elmassimo avatar floriandejonckheere avatar misfo avatar noteflakes avatar paulhenrich avatar ttilberg avatar wjordan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

polyphony's Issues

Signal trap not working correctly

After a trapped signal is handled, the backend does a poll that is repeatedly interrupted. This happens for both the io_uring and libev backends.

require 'polyphony' hangs in irb

I'm using:

  • ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin20]
  • MacOs Big Sur version 11.6
  • polyphony-0.71

When I go into irb and run require 'polyphony', it just hangs. I've rebooted my machine and that doesn't seem to help. This has worked successfully in a past irb session for me. Not sure what is going on now. Thanks.

I've also tried gem uninstall and then gem install and no luck with the require.

Provide better tracing for backend events

The current trace API does not really provide helpful information:

  • The events are from the point of view of the backend, and not really from the point of view of fibers.
  • Some events are missing information such as caller and the originating fiber (for example, when a fiber is scheduled, we want to know from where it was scheduled, and in the context of which fiber).

We also need to be able to transform the information for each event, provided as an array of values (for performance and simplicity), into something more meaningful - a hash, that we could later transform into nicely formatted text.

Segmentation fault in docker container when requiring

Given simpliest Dockerfile:

FROM ruby:3.0
RUN gem install polyphony
ENTRYPOINT "irb"

When starting container, trying to require polyphony, results in seg fault:

irb(main):001:0> require 'polyphony'
/usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/io.rb:131: [BUG] Segmentation fault at 0x0000000000000000
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0024 p:---- s:0135 e:000134 CFUNC  :backend_read
c:0023 p:0033 s:0126 e:000125 METHOD /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/io.rb:131
c:0022 p:0092 s:0117 e:000116 METHOD /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/io.rb:162
c:0021 p:0112 s:0106 e:000105 METHOD /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/core.rb:109 [FINISH]
c:0020 p:---- s:0100 e:000099 CFUNC  :parse
c:0019 p:0030 s:0096 e:000095 METHOD /usr/local/lib/ruby/3.0.0/ripper/sexp.rb:37
c:0018 p:0030 s:0085 e:000083 METHOD /usr/local/lib/ruby/3.0.0/irb.rb:856
c:0017 p:0176 s:0077 e:000076 BLOCK  /usr/local/lib/ruby/3.0.0/irb.rb:570
c:0016 p:0024 s:0072 e:000071 METHOD /usr/local/lib/ruby/3.0.0/irb.rb:751
c:0015 p:0007 s:0066 e:000065 BLOCK  /usr/local/lib/ruby/3.0.0/irb.rb:548
c:0014 p:0123 s:0061 e:000060 BLOCK  /usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:251 [FINISH]
c:0013 p:---- s:0057 e:000056 CFUNC  :loop
c:0012 p:0005 s:0053 e:000052 BLOCK  /usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:233 [FINISH]
c:0011 p:---- s:0050 e:000049 CFUNC  :catch
c:0010 p:0010 s:0045 e:000044 METHOD /usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:232
c:0009 p:0046 s:0041 E:0004d8 METHOD /usr/local/lib/ruby/3.0.0/irb.rb:547
c:0008 p:0004 s:0036 e:000035 BLOCK  /usr/local/lib/ruby/3.0.0/irb.rb:481 [FINISH]
c:0007 p:---- s:0033 e:000032 CFUNC  :catch
c:0006 p:0058 s:0028 E:0014c0 METHOD /usr/local/lib/ruby/3.0.0/irb.rb:480
c:0005 p:0104 s:0022 e:000021 METHOD /usr/local/lib/ruby/3.0.0/irb.rb:409
c:0004 p:0019 s:0016 e:000015 TOP    /usr/local/lib/ruby/gems/3.0.0/gems/irb-1.3.5/exe/irb:11 [FINISH]
c:0003 p:---- s:0013 e:000012 CFUNC  :load
c:0002 p:0112 s:0008 E:000870 EVAL   /usr/local/bin/irb:23 [FINISH]
c:0001 p:0000 s:0003 E:001370 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
/usr/local/bin/irb:23:in `<main>'
/usr/local/bin/irb:23:in `load'
/usr/local/lib/ruby/gems/3.0.0/gems/irb-1.3.5/exe/irb:11:in `<top (required)>'
/usr/local/lib/ruby/3.0.0/irb.rb:409:in `start'
/usr/local/lib/ruby/3.0.0/irb.rb:480:in `run'
/usr/local/lib/ruby/3.0.0/irb.rb:480:in `catch'
/usr/local/lib/ruby/3.0.0/irb.rb:481:in `block in run'
/usr/local/lib/ruby/3.0.0/irb.rb:547:in `eval_input'
/usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:232:in `each_top_level_statement'
/usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:232:in `catch'
/usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:233:in `block in each_top_level_statement'
/usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:233:in `loop'
/usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:251:in `block (2 levels) in each_top_level_statement'
/usr/local/lib/ruby/3.0.0/irb.rb:548:in `block in eval_input'
/usr/local/lib/ruby/3.0.0/irb.rb:751:in `signal_status'
/usr/local/lib/ruby/3.0.0/irb.rb:570:in `block (2 levels) in eval_input'
/usr/local/lib/ruby/3.0.0/irb.rb:856:in `assignment_expression?'
/usr/local/lib/ruby/3.0.0/ripper/sexp.rb:37:in `sexp'
/usr/local/lib/ruby/3.0.0/ripper/sexp.rb:37:in `parse'
/usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/core.rb:109:in `gets'
/usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/io.rb:162:in `gets'
/usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/io.rb:131:in `readpartial'
/usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/io.rb:131:in `backend_read'

-- Machine register context ------------------------------------------------
 RIP: 0x00007fec3a323df6 RBP: 0x0000556ff2788ed0 RSP: 0x00007ffef17a9f58
 RAX: 0x0000000000000000 RBX: 0x0000556ff2aa6bc0 RCX: 0x0000000000000013
 RDX: 0x00007fec3d99a810 RDI: 0x0000556ff2924ea8 RSI: 0x0000556ff28c88a0
  R8: 0x0000000000000000  R9: 0x0000000000000000 R10: 0x00007fec3a3177dd
 R11: 0x00007fec3a323df0 R12: 0x0000000000000000 R13: 0x0000000000002000
 R14: 0x0000556ff2924f80 R15: 0x00007ffef17a9fb0 EFL: 0x0000000000010246

-- C level backtrace information -------------------------------------------
/usr/local/lib/libruby.so.3.0(rb_print_backtrace+0x11) [0x7fec3e07d58c] vm_dump.c:758
/usr/local/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/usr/local/lib/libruby.so.3.0(rb_bug_for_fatal_signal+0xf0) [0x7fec3de882b0] error.c:786
/usr/local/lib/libruby.so.3.0(sigsegv+0x49) [0x7fec3dfd4b89] signal.c:960
/lib/x86_64-linux-gnu/libc.so.6(0x7fec3dc28d60) [0x7fec3dc28d60]
/usr/local/bundle/gems/polyphony-0.71/lib/polyphony_ext.so(io_uring_get_sqe+0x6) [0x7fec3a323df6] ../liburing/queue.c:301
/usr/local/bundle/gems/polyphony-0.71/lib/polyphony_ext.so(io_uring_get_sqe) (null):0
/usr/local/bundle/gems/polyphony-0.71/lib/polyphony_ext.so(Backend_read+0x1c3) [0x7fec3a31ea63] backend_io_uring.c:348
/usr/local/lib/libruby.so.3.0(vm_cfp_consistent_p+0x0) [0x7fec3e053dcc] vm_insnhelper.c:2926
/usr/local/lib/libruby.so.3.0(vm_call_cfunc_with_frame) vm_insnhelper.c:2928
/usr/local/lib/libruby.so.3.0(vm_sendish+0x366) [0x7fec3e05ed46] vm_insnhelper.c:4527
/usr/local/lib/libruby.so.3.0(vm_exec_core+0x94) [0x7fec3e061c24] insns.def:789
/usr/local/lib/libruby.so.3.0(rb_vm_exec+0x182) [0x7fec3e0671b2] vm.c:2163
/usr/local/lib/libruby.so.3.0(rb_funcallv_public+0x1ba) [0x7fec3e0721aa] vm_eval.c:72
/usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so(ripper_lex_get_generic+0x17) [0x7fec3a34eba7] ripper.y:13546
/usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so(lex_getline+0x6) [0x7fec3a350152] ripper.y:6270
/usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so(nextline) ripper.y:6437
/usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so(nextc+0x8) [0x7fec3a36add8] ripper.y:6479
/usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so(parser_prepare) ripper.y:8287
/usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so(ripper_parse0) ripper.y:13626
/usr/local/lib/libruby.so.3.0(rb_ensure+0x113) [0x7fec3de90ac3] eval.c:1162
/usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so(ripper_parse+0x95) [0x7fec3a34e8d5] ripper.y:13666
/usr/local/lib/libruby.so.3.0(vm_cfp_consistent_p+0x0) [0x7fec3e053dcc] vm_insnhelper.c:2926
/usr/local/lib/libruby.so.3.0(vm_call_cfunc_with_frame) vm_insnhelper.c:2928
/usr/local/lib/libruby.so.3.0(vm_sendish+0x366) [0x7fec3e05ed46] vm_insnhelper.c:4527
/usr/local/lib/libruby.so.3.0(vm_exec_core+0x94) [0x7fec3e061c24] insns.def:789
/usr/local/lib/libruby.so.3.0(rb_vm_exec+0x95e) [0x7fec3e06798e] vm.c:2172
/usr/local/lib/libruby.so.3.0(invoke_block_from_c_bh+0x130) [0x7fec3e0688f2] vm.c:1263
/usr/local/lib/libruby.so.3.0(vm_yield) vm.c:1398
/usr/local/lib/libruby.so.3.0(rb_yield_0) vm_eval.c:1331
/usr/local/lib/libruby.so.3.0(loop_i) vm_eval.c:1430
/usr/local/lib/libruby.so.3.0(rb_vrescue2+0x10b) [0x7fec3de9044b] eval.c:1019
/usr/local/lib/libruby.so.3.0(rb_rescue2+0x8a) [0x7fec3de906ba] eval.c:996
/usr/local/lib/libruby.so.3.0(vm_cfp_consistent_p+0x0) [0x7fec3e053dcc] vm_insnhelper.c:2926
/usr/local/lib/libruby.so.3.0(vm_call_cfunc_with_frame) vm_insnhelper.c:2928
/usr/local/lib/libruby.so.3.0(vm_sendish+0x366) [0x7fec3e05ed46] vm_insnhelper.c:4527
/usr/local/lib/libruby.so.3.0(vm_exec_core+0x103) [0x7fec3e061c93] insns.def:770
/usr/local/lib/libruby.so.3.0(rb_vm_exec+0x182) [0x7fec3e0671b2] vm.c:2163
/usr/local/lib/libruby.so.3.0(catch_i+0x2bc) [0x7fec3e0696ec] vm.c:1263
/usr/local/lib/libruby.so.3.0(vm_catch_protect+0xe2) [0x7fec3e05a112] vm_eval.c:2405
/usr/local/lib/libruby.so.3.0(rb_catch_obj+0x4d) [0x7fec3e05a2dd] vm_eval.c:2431
/usr/local/lib/libruby.so.3.0(vm_cfp_consistent_p+0x0) [0x7fec3e053dcc] vm_insnhelper.c:2926
/usr/local/lib/libruby.so.3.0(vm_call_cfunc_with_frame) vm_insnhelper.c:2928
/usr/local/lib/libruby.so.3.0(vm_sendish+0x366) [0x7fec3e05ed46] vm_insnhelper.c:4527
/usr/local/lib/libruby.so.3.0(vm_exec_core+0x103) [0x7fec3e061c93] insns.def:770
/usr/local/lib/libruby.so.3.0(rb_vm_exec+0x182) [0x7fec3e0671b2] vm.c:2163
/usr/local/lib/libruby.so.3.0(catch_i+0x2bc) [0x7fec3e0696ec] vm.c:1263
/usr/local/lib/libruby.so.3.0(vm_catch_protect+0xe2) [0x7fec3e05a112] vm_eval.c:2405
/usr/local/lib/libruby.so.3.0(rb_catch_obj+0x4d) [0x7fec3e05a2dd] vm_eval.c:2431
/usr/local/lib/libruby.so.3.0(vm_cfp_consistent_p+0x0) [0x7fec3e053dcc] vm_insnhelper.c:2926
/usr/local/lib/libruby.so.3.0(vm_call_cfunc_with_frame) vm_insnhelper.c:2928
/usr/local/lib/libruby.so.3.0(vm_sendish+0x366) [0x7fec3e05ed46] vm_insnhelper.c:4527
/usr/local/lib/libruby.so.3.0(vm_exec_core+0x103) [0x7fec3e061c93] insns.def:770
/usr/local/lib/libruby.so.3.0(rb_vm_exec+0x95e) [0x7fec3e06798e] vm.c:2172
/usr/local/lib/libruby.so.3.0(raise_load_if_failed+0x0) [0x7fec3dee9fb9] load.c:594
/usr/local/lib/libruby.so.3.0(rb_load_internal) load.c:654
/usr/local/lib/libruby.so.3.0(rb_f_load) load.c:726
/usr/local/lib/libruby.so.3.0(vm_cfp_consistent_p+0x0) [0x7fec3e053dcc] vm_insnhelper.c:2926
/usr/local/lib/libruby.so.3.0(vm_call_cfunc_with_frame) vm_insnhelper.c:2928
/usr/local/lib/libruby.so.3.0(vm_sendish+0x366) [0x7fec3e05ed46] vm_insnhelper.c:4527
/usr/local/lib/libruby.so.3.0(vm_exec_core+0x94) [0x7fec3e061c24] insns.def:789
/usr/local/lib/libruby.so.3.0(rb_vm_exec+0x182) [0x7fec3e0671b2] vm.c:2163
/usr/local/lib/libruby.so.3.0(rb_ec_exec_node+0xc6) [0x7fec3de8d146] eval.c:317
/usr/local/lib/libruby.so.3.0(ruby_run_node+0x56) [0x7fec3de92e16] eval.c:375
/usr/local/bin/ruby(main+0x5b) [0x556ff031510b] ./main.c:50

-- Other runtime information -----------------------------------------------

* Loaded script: irb

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb
    5 /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
    6 /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/trans/transdb.so
    7 /usr/local/lib/ruby/3.0.0/x86_64-linux/rbconfig.rb
    8 /usr/local/lib/ruby/3.0.0/rubygems/compatibility.rb
    9 /usr/local/lib/ruby/3.0.0/rubygems/defaults.rb
   10 /usr/local/lib/ruby/3.0.0/rubygems/deprecate.rb
   11 /usr/local/lib/ruby/3.0.0/rubygems/errors.rb
   12 /usr/local/lib/ruby/3.0.0/rubygems/exceptions.rb
   13 /usr/local/lib/ruby/3.0.0/rubygems/basic_specification.rb
   14 /usr/local/lib/ruby/3.0.0/rubygems/stub_specification.rb
   15 /usr/local/lib/ruby/3.0.0/rubygems/text.rb
   16 /usr/local/lib/ruby/3.0.0/rubygems/user_interaction.rb
   17 /usr/local/lib/ruby/3.0.0/rubygems/specification_policy.rb
   18 /usr/local/lib/ruby/3.0.0/rubygems/util/list.rb
   19 /usr/local/lib/ruby/3.0.0/rubygems/platform.rb
   20 /usr/local/lib/ruby/3.0.0/rubygems/version.rb
   21 /usr/local/lib/ruby/3.0.0/rubygems/requirement.rb
   22 /usr/local/lib/ruby/3.0.0/rubygems/specification.rb
   23 /usr/local/lib/ruby/3.0.0/rubygems/util.rb
   24 /usr/local/lib/ruby/3.0.0/rubygems/dependency.rb
   25 /usr/local/lib/ruby/3.0.0/rubygems/core_ext/kernel_gem.rb
   26 /usr/local/lib/ruby/3.0.0/x86_64-linux/monitor.so
   27 /usr/local/lib/ruby/3.0.0/monitor.rb
   28 /usr/local/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb
   29 /usr/local/lib/ruby/3.0.0/rubygems/core_ext/kernel_warn.rb
   30 /usr/local/lib/ruby/3.0.0/rubygems.rb
   31 /usr/local/lib/ruby/3.0.0/rubygems/path_support.rb
   32 /usr/local/lib/ruby/3.0.0/did_you_mean/version.rb
   33 /usr/local/lib/ruby/3.0.0/did_you_mean/core_ext/name_error.rb
   34 /usr/local/lib/ruby/3.0.0/did_you_mean/levenshtein.rb
   35 /usr/local/lib/ruby/3.0.0/did_you_mean/jaro_winkler.rb
   36 /usr/local/lib/ruby/3.0.0/did_you_mean/spell_checker.rb
   37 /usr/local/lib/ruby/3.0.0/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
   38 /usr/local/lib/ruby/3.0.0/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
   39 /usr/local/lib/ruby/3.0.0/did_you_mean/spell_checkers/name_error_checkers.rb
   40 /usr/local/lib/ruby/3.0.0/did_you_mean/spell_checkers/method_name_checker.rb
   41 /usr/local/lib/ruby/3.0.0/did_you_mean/spell_checkers/key_error_checker.rb
   42 /usr/local/lib/ruby/3.0.0/did_you_mean/spell_checkers/null_checker.rb
   43 /usr/local/lib/ruby/3.0.0/did_you_mean/tree_spell_checker.rb
   44 /usr/local/lib/ruby/3.0.0/did_you_mean/spell_checkers/require_path_checker.rb
   45 /usr/local/lib/ruby/3.0.0/did_you_mean/formatters/plain_formatter.rb
   46 /usr/local/lib/ruby/3.0.0/did_you_mean.rb
   47 /usr/local/lib/ruby/3.0.0/tsort.rb
   48 /usr/local/lib/ruby/3.0.0/rubygems/request_set/gem_dependency_api.rb
   49 /usr/local/lib/ruby/3.0.0/rubygems/request_set/lockfile/parser.rb
   50 /usr/local/lib/ruby/3.0.0/rubygems/request_set/lockfile/tokenizer.rb
   51 /usr/local/lib/ruby/3.0.0/rubygems/request_set/lockfile.rb
   52 /usr/local/lib/ruby/3.0.0/rubygems/request_set.rb
   53 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb
   54 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb
   55 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/errors.rb
   56 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb
   57 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb
   58 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb
   59 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb
   60 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb
   61 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb
   62 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb
   63 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb
   64 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb
   65 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb
   66 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/state.rb
   67 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb
   68 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb
   69 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb
   70 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/resolver.rb
   71 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo/modules/ui.rb
   72 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo/lib/molinillo.rb
   73 /usr/local/lib/ruby/3.0.0/rubygems/resolver/molinillo.rb
   74 /usr/local/lib/ruby/3.0.0/rubygems/resolver/activation_request.rb
   75 /usr/local/lib/ruby/3.0.0/rubygems/resolver/conflict.rb
   76 /usr/local/lib/ruby/3.0.0/rubygems/resolver/dependency_request.rb
   77 /usr/local/lib/ruby/3.0.0/rubygems/resolver/requirement_list.rb
   78 /usr/local/lib/ruby/3.0.0/rubygems/resolver/stats.rb
   79 /usr/local/lib/ruby/3.0.0/rubygems/resolver/set.rb
   80 /usr/local/lib/ruby/3.0.0/rubygems/resolver/api_set.rb
   81 /usr/local/lib/ruby/3.0.0/rubygems/resolver/composed_set.rb
   82 /usr/local/lib/ruby/3.0.0/rubygems/resolver/best_set.rb
   83 /usr/local/lib/ruby/3.0.0/rubygems/resolver/current_set.rb
   84 /usr/local/lib/ruby/3.0.0/rubygems/resolver/git_set.rb
   85 /usr/local/lib/ruby/3.0.0/rubygems/resolver/index_set.rb
   86 /usr/local/lib/ruby/3.0.0/rubygems/resolver/installer_set.rb
   87 /usr/local/lib/ruby/3.0.0/rubygems/resolver/lock_set.rb
   88 /usr/local/lib/ruby/3.0.0/rubygems/resolver/vendor_set.rb
   89 /usr/local/lib/ruby/3.0.0/rubygems/resolver/source_set.rb
   90 /usr/local/lib/ruby/3.0.0/rubygems/resolver/specification.rb
   91 /usr/local/lib/ruby/3.0.0/rubygems/resolver/spec_specification.rb
   92 /usr/local/lib/ruby/3.0.0/rubygems/resolver/api_specification.rb
   93 /usr/local/lib/ruby/3.0.0/rubygems/resolver/git_specification.rb
   94 /usr/local/lib/ruby/3.0.0/rubygems/resolver/index_specification.rb
   95 /usr/local/lib/ruby/3.0.0/rubygems/resolver/installed_specification.rb
   96 /usr/local/lib/ruby/3.0.0/rubygems/resolver/local_specification.rb
   97 /usr/local/lib/ruby/3.0.0/rubygems/resolver/lock_specification.rb
   98 /usr/local/lib/ruby/3.0.0/rubygems/resolver/vendor_specification.rb
   99 /usr/local/lib/ruby/3.0.0/rubygems/resolver.rb
  100 /usr/local/lib/ruby/3.0.0/uri/version.rb
  101 /usr/local/lib/ruby/3.0.0/uri/rfc2396_parser.rb
  102 /usr/local/lib/ruby/3.0.0/uri/rfc3986_parser.rb
  103 /usr/local/lib/ruby/3.0.0/uri/common.rb
  104 /usr/local/lib/ruby/3.0.0/uri/generic.rb
  105 /usr/local/lib/ruby/3.0.0/uri/file.rb
  106 /usr/local/lib/ruby/3.0.0/uri/ftp.rb
  107 /usr/local/lib/ruby/3.0.0/uri/http.rb
  108 /usr/local/lib/ruby/3.0.0/uri/https.rb
  109 /usr/local/lib/ruby/3.0.0/uri/ldap.rb
  110 /usr/local/lib/ruby/3.0.0/uri/ldaps.rb
  111 /usr/local/lib/ruby/3.0.0/uri/mailto.rb
  112 /usr/local/lib/ruby/3.0.0/uri.rb
  113 /usr/local/lib/ruby/3.0.0/rubygems/source/git.rb
  114 /usr/local/lib/ruby/3.0.0/rubygems/source/installed.rb
  115 /usr/local/lib/ruby/3.0.0/rubygems/source/specific_file.rb
  116 /usr/local/lib/ruby/3.0.0/rubygems/source/local.rb
  117 /usr/local/lib/ruby/3.0.0/rubygems/source/lock.rb
  118 /usr/local/lib/ruby/3.0.0/rubygems/source/vendor.rb
  119 /usr/local/lib/ruby/3.0.0/rubygems/source.rb
  120 /usr/local/lib/ruby/3.0.0/set.rb
  121 /usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so
  122 /usr/local/lib/ruby/3.0.0/ripper/core.rb
  123 /usr/local/lib/ruby/3.0.0/ripper/lexer.rb
  124 /usr/local/lib/ruby/3.0.0/ripper/filter.rb
  125 /usr/local/lib/ruby/3.0.0/ripper/sexp.rb
  126 /usr/local/lib/ruby/3.0.0/ripper.rb
  127 /usr/local/lib/ruby/3.0.0/x86_64-linux/io/console.so
  128 /usr/local/lib/ruby/3.0.0/timeout.rb
  129 /usr/local/lib/ruby/3.0.0/forwardable/impl.rb
  130 /usr/local/lib/ruby/3.0.0/forwardable.rb
  131 /usr/local/lib/ruby/3.0.0/reline/version.rb
  132 /usr/local/lib/ruby/3.0.0/reline/config.rb
  133 /usr/local/lib/ruby/3.0.0/reline/key_actor/base.rb
  134 /usr/local/lib/ruby/3.0.0/reline/key_actor/emacs.rb
  135 /usr/local/lib/ruby/3.0.0/reline/key_actor/vi_command.rb
  136 /usr/local/lib/ruby/3.0.0/reline/key_actor/vi_insert.rb
  137 /usr/local/lib/ruby/3.0.0/reline/key_actor.rb
  138 /usr/local/lib/ruby/3.0.0/reline/key_stroke.rb
  139 /usr/local/lib/ruby/3.0.0/reline/kill_ring.rb
  140 /usr/local/lib/ruby/3.0.0/reline/unicode/east_asian_width.rb
  141 /usr/local/lib/ruby/3.0.0/reline/unicode.rb
  142 /usr/local/lib/ruby/3.0.0/delegate.rb
  143 /usr/local/lib/ruby/3.0.0/fileutils.rb
  144 /usr/local/lib/ruby/3.0.0/x86_64-linux/etc.so
  145 /usr/local/lib/ruby/3.0.0/tmpdir.rb
  146 /usr/local/lib/ruby/3.0.0/tempfile.rb
  147 /usr/local/lib/ruby/3.0.0/reline/line_editor.rb
  148 /usr/local/lib/ruby/3.0.0/reline/history.rb
  149 /usr/local/lib/ruby/3.0.0/reline/ansi.rb
  150 /usr/local/lib/ruby/3.0.0/reline/general_io.rb
  151 /usr/local/lib/ruby/3.0.0/reline.rb
  152 /usr/local/lib/ruby/3.0.0/irb/init.rb
  153 /usr/local/lib/ruby/3.0.0/irb/workspace.rb
  154 /usr/local/lib/ruby/3.0.0/irb/inspector.rb
  155 /usr/local/lib/ruby/3.0.0/irb/src_encoding.rb
  156 /usr/local/lib/ruby/3.0.0/irb/magic-file.rb
  157 /usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb
  158 /usr/local/lib/ruby/3.0.0/irb/completion.rb
  159 /usr/local/lib/ruby/3.0.0/irb/input-method.rb
  160 /usr/local/lib/ruby/3.0.0/irb/output-method.rb
  161 /usr/local/lib/ruby/3.0.0/irb/context.rb
  162 /usr/local/lib/ruby/3.0.0/irb/extend-command.rb
  163 /usr/local/lib/ruby/3.0.0/irb/locale.rb
  164 /usr/local/lib/ruby/3.0.0/irb/color.rb
  165 /usr/local/lib/ruby/3.0.0/irb/version.rb
  166 /usr/local/lib/ruby/3.0.0/irb/easter-egg.rb
  167 /usr/local/lib/ruby/3.0.0/irb.rb
  168 /usr/local/lib/ruby/3.0.0/rubygems/bundler_version_finder.rb
  169 /usr/local/lib/ruby/3.0.0/prettyprint.rb
  170 /usr/local/lib/ruby/3.0.0/pp.rb
  171 /usr/local/lib/ruby/3.0.0/irb/color_printer.rb
  172 /usr/local/lib/ruby/3.0.0/irb/ext/save-history.rb
  173 /usr/local/lib/ruby/3.0.0/x86_64-linux/fiber.so
  174 /usr/local/lib/ruby/3.0.0/x86_64-linux/socket.so
  175 /usr/local/lib/ruby/3.0.0/x86_64-linux/io/wait.so
  176 /usr/local/lib/ruby/3.0.0/socket.rb
  177 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony_ext.so
  178 /usr/local/lib/ruby/3.0.0/open3.rb
  179 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/core/exceptions.rb
  180 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/core.rb
  181 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/thread.rb
  182 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/fiber.rb
  183 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/io.rb
  184 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/core/throttler.rb
  185 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/core/global_api.rb
  186 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/core/resource_pool.rb
  187 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/core/sync.rb
  188 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/core/timer.rb
  189 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/core/thread_pool.rb
  190 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/socket.rb
  191 /usr/local/lib/ruby/3.0.0/x86_64-linux/digest.so
  192 /usr/local/lib/ruby/3.0.0/digest.rb
  193 /usr/local/lib/ruby/3.0.0/x86_64-linux/openssl.so
  194 /usr/local/lib/ruby/3.0.0/openssl/bn.rb
  195 /usr/local/lib/ruby/3.0.0/openssl/marshal.rb
  196 /usr/local/lib/ruby/3.0.0/openssl/pkey.rb
  197 /usr/local/lib/ruby/3.0.0/openssl/cipher.rb
  198 /usr/local/lib/ruby/3.0.0/x86_64-linux/stringio.so
  199 /usr/local/lib/ruby/3.0.0/openssl/config.rb
  200 /usr/local/lib/ruby/3.0.0/openssl/digest.rb
  201 /usr/local/lib/ruby/3.0.0/openssl/hmac.rb
  202 /usr/local/lib/ruby/3.0.0/openssl/x509.rb
  203 /usr/local/lib/ruby/3.0.0/openssl/buffering.rb
  204 /usr/local/lib/ruby/3.0.0/x86_64-linux/io/nonblock.so
  205 /usr/local/lib/ruby/3.0.0/ipaddr.rb
  206 /usr/local/lib/ruby/3.0.0/openssl/ssl.rb
  207 /usr/local/lib/ruby/3.0.0/openssl/pkcs5.rb
  208 /usr/local/lib/ruby/3.0.0/openssl/version.rb
  209 /usr/local/lib/ruby/3.0.0/openssl.rb
  210 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/extensions/openssl.rb
  211 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/net.rb
  212 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony/adapters/process.rb
  213 /usr/local/bundle/gems/polyphony-0.71/lib/polyphony.rb

* Process memory map:

556ff0314000-556ff0315000 r--p 00000000 fe:01 257666                     /usr/local/bin/ruby
556ff0315000-556ff0316000 r-xp 00001000 fe:01 257666                     /usr/local/bin/ruby
556ff0316000-556ff0317000 r--p 00002000 fe:01 257666                     /usr/local/bin/ruby
556ff0317000-556ff0318000 r--p 00002000 fe:01 257666                     /usr/local/bin/ruby
556ff0318000-556ff0319000 rw-p 00003000 fe:01 257666                     /usr/local/bin/ruby
556ff1f3f000-556ff2c20000 rw-p 00000000 00:00 0                          [heap]
7fec37f30000-7fec37f8d000 r--s 00000000 fe:01 448318                     /usr/local/bundle/gems/polyphony-0.71/lib/polyphony_ext.so
7fec37f8d000-7fec3814f000 r--s 00000000 fe:01 362319                     /lib/x86_64-linux-gnu/libc-2.31.so
7fec3814f000-7fec391b8000 rw-p 00000000 00:00 0
7fec391b8000-7fec39df8000 r--s 00000000 fe:01 434715                     /usr/local/lib/libruby.so.3.0.2
7fec39df8000-7fec39e2d000 r--s 00000000 fe:01 257666                     /usr/local/bin/ruby
7fec39e2d000-7fec39eee000 rw-p 00000000 00:00 0
7fec39eee000-7fec39f74000 r--p 00000000 fe:01 363050                     /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
7fec39f74000-7fec3a11b000 r-xp 00086000 fe:01 363050                     /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
7fec3a11b000-7fec3a1ab000 r--p 0022d000 fe:01 363050                     /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
7fec3a1ab000-7fec3a1ac000 ---p 002bd000 fe:01 363050                     /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
7fec3a1ac000-7fec3a1dc000 r--p 002bd000 fe:01 363050                     /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
7fec3a1dc000-7fec3a1de000 rw-p 002ed000 fe:01 363050                     /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
7fec3a1de000-7fec3a1e2000 rw-p 00000000 00:00 0
7fec3a1e2000-7fec3a1ff000 r--p 00000000 fe:01 363088                     /usr/lib/x86_64-linux-gnu/libssl.so.1.1
7fec3a1ff000-7fec3a24d000 r-xp 0001d000 fe:01 363088                     /usr/lib/x86_64-linux-gnu/libssl.so.1.1
7fec3a24d000-7fec3a267000 r--p 0006b000 fe:01 363088                     /usr/lib/x86_64-linux-gnu/libssl.so.1.1
7fec3a267000-7fec3a268000 ---p 00085000 fe:01 363088                     /usr/lib/x86_64-linux-gnu/libssl.so.1.1
7fec3a268000-7fec3a271000 r--p 00085000 fe:01 363088                     /usr/lib/x86_64-linux-gnu/libssl.so.1.1
7fec3a271000-7fec3a275000 rw-p 0008e000 fe:01 363088                     /usr/lib/x86_64-linux-gnu/libssl.so.1.1
7fec3a276000-7fec3a278000 r--p 00000000 fe:01 435860                     /usr/local/lib/ruby/3.0.0/x86_64-linux/digest.so
7fec3a278000-7fec3a27a000 r-xp 00002000 fe:01 435860                     /usr/local/lib/ruby/3.0.0/x86_64-linux/digest.so
7fec3a27a000-7fec3a27b000 r--p 00004000 fe:01 435860                     /usr/local/lib/ruby/3.0.0/x86_64-linux/digest.so
7fec3a27b000-7fec3a27c000 r--p 00004000 fe:01 435860                     /usr/local/lib/ruby/3.0.0/x86_64-linux/digest.so
7fec3a27c000-7fec3a27d000 rw-p 00005000 fe:01 435860                     /usr/local/lib/ruby/3.0.0/x86_64-linux/digest.so
7fec3a27d000-7fec3a292000 r--p 00000000 fe:01 435940                     /usr/local/lib/ruby/3.0.0/x86_64-linux/openssl.so
7fec3a292000-7fec3a2c7000 r-xp 00015000 fe:01 435940                     /usr/local/lib/ruby/3.0.0/x86_64-linux/openssl.so
7fec3a2c7000-7fec3a2d9000 r--p 0004a000 fe:01 435940                     /usr/local/lib/ruby/3.0.0/x86_64-linux/openssl.so
7fec3a2d9000-7fec3a2da000 ---p 0005c000 fe:01 435940                     /usr/local/lib/ruby/3.0.0/x86_64-linux/openssl.so
7fec3a2da000-7fec3a2dc000 r--p 0005c000 fe:01 435940                     /usr/local/lib/ruby/3.0.0/x86_64-linux/openssl.so
7fec3a2dc000-7fec3a2de000 rw-p 0005e000 fe:01 435940                     /usr/local/lib/ruby/3.0.0/x86_64-linux/openssl.so
7fec3a2de000-7fec3a2df000 rw-p 00000000 00:00 0
7fec3a2df000-7fec3a2e0000 r--p 00000000 fe:01 435932                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/wait.so
7fec3a2e0000-7fec3a2e1000 r-xp 00001000 fe:01 435932                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/wait.so
7fec3a2e1000-7fec3a2e2000 r--p 00002000 fe:01 435932                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/wait.so
7fec3a2e2000-7fec3a2e3000 r--p 00002000 fe:01 435932                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/wait.so
7fec3a2e3000-7fec3a2e4000 rw-p 00003000 fe:01 435932                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/wait.so
7fec3a2e4000-7fec3a2ea000 r--p 00000000 fe:01 435951                     /usr/local/lib/ruby/3.0.0/x86_64-linux/socket.so
7fec3a2ea000-7fec3a30a000 r-xp 00006000 fe:01 435951                     /usr/local/lib/ruby/3.0.0/x86_64-linux/socket.so
7fec3a30a000-7fec3a312000 r--p 00026000 fe:01 435951                     /usr/local/lib/ruby/3.0.0/x86_64-linux/socket.so
7fec3a312000-7fec3a313000 r--p 0002d000 fe:01 435951                     /usr/local/lib/ruby/3.0.0/x86_64-linux/socket.so
7fec3a313000-7fec3a314000 rw-p 0002e000 fe:01 435951                     /usr/local/lib/ruby/3.0.0/x86_64-linux/socket.so
7fec3a314000-7fec3a31c000 r--p 00000000 fe:01 448318                     /usr/local/bundle/gems/polyphony-0.71/lib/polyphony_ext.so
7fec3a31c000-7fec3a328000 r-xp 00008000 fe:01 448318                     /usr/local/bundle/gems/polyphony-0.71/lib/polyphony_ext.so
7fec3a328000-7fec3a32c000 r--p 00014000 fe:01 448318                     /usr/local/bundle/gems/polyphony-0.71/lib/polyphony_ext.so
7fec3a32c000-7fec3a32d000 ---p 00018000 fe:01 448318                     /usr/local/bundle/gems/polyphony-0.71/lib/polyphony_ext.so
7fec3a32d000-7fec3a32e000 r--p 00018000 fe:01 448318                     /usr/local/bundle/gems/polyphony-0.71/lib/polyphony_ext.so
7fec3a32e000-7fec3a32f000 rw-p 00019000 fe:01 448318                     /usr/local/bundle/gems/polyphony-0.71/lib/polyphony_ext.so
7fec3a32f000-7fec3a330000 r--p 00000000 fe:01 435926                     /usr/local/lib/ruby/3.0.0/x86_64-linux/fiber.so
7fec3a330000-7fec3a331000 r-xp 00001000 fe:01 435926                     /usr/local/lib/ruby/3.0.0/x86_64-linux/fiber.so
7fec3a331000-7fec3a332000 r--p 00002000 fe:01 435926                     /usr/local/lib/ruby/3.0.0/x86_64-linux/fiber.so
7fec3a332000-7fec3a333000 r--p 00002000 fe:01 435926                     /usr/local/lib/ruby/3.0.0/x86_64-linux/fiber.so
7fec3a333000-7fec3a334000 rw-p 00003000 fe:01 435926                     /usr/local/lib/ruby/3.0.0/x86_64-linux/fiber.so
7fec3a334000-7fec3a336000 r--p 00000000 fe:01 435924                     /usr/local/lib/ruby/3.0.0/x86_64-linux/etc.so
7fec3a336000-7fec3a339000 r-xp 00002000 fe:01 435924                     /usr/local/lib/ruby/3.0.0/x86_64-linux/etc.so
7fec3a339000-7fec3a33b000 r--p 00005000 fe:01 435924                     /usr/local/lib/ruby/3.0.0/x86_64-linux/etc.so
7fec3a33b000-7fec3a33c000 r--p 00006000 fe:01 435924                     /usr/local/lib/ruby/3.0.0/x86_64-linux/etc.so
7fec3a33c000-7fec3a33d000 rw-p 00007000 fe:01 435924                     /usr/local/lib/ruby/3.0.0/x86_64-linux/etc.so
7fec3a33d000-7fec3a33f000 r--p 00000000 fe:01 435930                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/console.so
7fec3a33f000-7fec3a343000 r-xp 00002000 fe:01 435930                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/console.so
7fec3a343000-7fec3a344000 r--p 00006000 fe:01 435930                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/console.so
7fec3a344000-7fec3a345000 ---p 00007000 fe:01 435930                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/console.so
7fec3a345000-7fec3a346000 r--p 00007000 fe:01 435930                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/console.so
7fec3a346000-7fec3a347000 rw-p 00008000 fe:01 435930                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/console.so
7fec3a347000-7fec3a34d000 r--p 00000000 fe:01 435950                     /usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so
7fec3a34d000-7fec3a36d000 r-xp 00006000 fe:01 435950                     /usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so
7fec3a36d000-7fec3a385000 r--p 00026000 fe:01 435950                     /usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so
7fec3a385000-7fec3a386000 ---p 0003e000 fe:01 435950                     /usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so
7fec3a386000-7fec3a388000 r--p 0003e000 fe:01 435950                     /usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so
7fec3a388000-7fec3a389000 rw-p 00040000 fe:01 435950                     /usr/local/lib/ruby/3.0.0/x86_64-linux/ripper.so
7fec3a389000-7fec3a38a000 r--p 00000000 fe:01 435937                     /usr/local/lib/ruby/3.0.0/x86_64-linux/monitor.so
7fec3a38a000-7fec3a38b000 r-xp 00001000 fe:01 435937                     /usr/local/lib/ruby/3.0.0/x86_64-linux/monitor.so
7fec3a38b000-7fec3a38c000 r--p 00002000 fe:01 435937                     /usr/local/lib/ruby/3.0.0/x86_64-linux/monitor.so
7fec3a38c000-7fec3a38d000 r--p 00002000 fe:01 435937                     /usr/local/lib/ruby/3.0.0/x86_64-linux/monitor.so
7fec3a38d000-7fec3a38e000 rw-p 00003000 fe:01 435937                     /usr/local/lib/ruby/3.0.0/x86_64-linux/monitor.so
7fec3a38e000-7fec3a38f000 r--p 00000000 fe:01 435910                     /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/trans/transdb.so
7fec3a38f000-7fec3a391000 r-xp 00001000 fe:01 435910                     /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/trans/transdb.so
7fec3a391000-7fec3a392000 r--p 00003000 fe:01 435910                     /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/trans/transdb.so
7fec3a392000-7fec3a393000 r--p 00003000 fe:01 435910                     /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/trans/transdb.so
7fec3a393000-7fec3a394000 rw-p 00004000 fe:01 435910                     /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/trans/transdb.so
7fec3a394000-7fec3a395000 r--p 00000000 fe:01 435866                     /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fec3a395000-7fec3a396000 r-xp 00001000 fe:01 435866                     /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fec3a396000-7fec3a397000 r--p 00002000 fe:01 435866                     /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fec3a397000-7fec3a398000 r--p 00002000 fe:01 435866                     /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fec3a398000-7fec3a399000 rw-p 00003000 fe:01 435866                     /usr/local/lib/ruby/3.0.0/x86_64-linux/enc/encdb.so
7fec3a399000-7fec3a39a000 ---p 00000000 00:00 0
7fec3a39a000-7fec3a43b000 rw-p 00000000 00:00 0
7fec3a43b000-7fec3a43c000 ---p 00000000 00:00 0
7fec3a43c000-7fec3a4dd000 rw-p 00000000 00:00 0
7fec3a4dd000-7fec3a4de000 ---p 00000000 00:00 0
7fec3a4de000-7fec3a57f000 rw-p 00000000 00:00 0
7fec3a57f000-7fec3a580000 ---p 00000000 00:00 0
7fec3a580000-7fec3a621000 rw-p 00000000 00:00 0
7fec3a621000-7fec3a622000 ---p 00000000 00:00 0
7fec3a622000-7fec3a6c3000 rw-p 00000000 00:00 0
7fec3a6c3000-7fec3a6c4000 ---p 00000000 00:00 0
7fec3a6c4000-7fec3a765000 rw-p 00000000 00:00 0
7fec3a765000-7fec3a766000 ---p 00000000 00:00 0
7fec3a766000-7fec3a807000 rw-p 00000000 00:00 0
7fec3a807000-7fec3a808000 ---p 00000000 00:00 0
7fec3a808000-7fec3a8a9000 rw-p 00000000 00:00 0
7fec3a8a9000-7fec3a8aa000 ---p 00000000 00:00 0
7fec3a8aa000-7fec3a94b000 rw-p 00000000 00:00 0
7fec3a94b000-7fec3a94c000 ---p 00000000 00:00 0
7fec3a94c000-7fec3a9ed000 rw-p 00000000 00:00 0
7fec3a9ed000-7fec3a9ee000 ---p 00000000 00:00 0
7fec3a9ee000-7fec3aa8f000 rw-p 00000000 00:00 0
7fec3aa8f000-7fec3aa90000 ---p 00000000 00:00 0
7fec3aa90000-7fec3ab31000 rw-p 00000000 00:00 0
7fec3ab31000-7fec3ab32000 ---p 00000000 00:00 0
7fec3ab32000-7fec3abd3000 rw-p 00000000 00:00 0
7fec3abd3000-7fec3abd4000 ---p 00000000 00:00 0
7fec3abd4000-7fec3ac75000 rw-p 00000000 00:00 0
7fec3ac75000-7fec3ac76000 ---p 00000000 00:00 0
7fec3ac76000-7fec3ad17000 rw-p 00000000 00:00 0
7fec3ad17000-7fec3ad18000 ---p 00000000 00:00 0
7fec3ad18000-7fec3adb9000 rw-p 00000000 00:00 0
7fec3adb9000-7fec3adba000 ---p 00000000 00:00 0
7fec3adba000-7fec3ae5b000 rw-p 00000000 00:00 0
7fec3ae5b000-7fec3ae5c000 ---p 00000000 00:00 0
7fec3ae5c000-7fec3aefd000 rw-p 00000000 00:00 0
7fec3aefd000-7fec3aefe000 ---p 00000000 00:00 0
7fec3aefe000-7fec3af9f000 rw-p 00000000 00:00 0
7fec3af9f000-7fec3afa0000 ---p 00000000 00:00 0
7fec3afa0000-7fec3b041000 rw-p 00000000 00:00 0
7fec3b041000-7fec3b042000 ---p 00000000 00:00 0
7fec3b042000-7fec3b0e3000 rw-p 00000000 00:00 0
7fec3b0e3000-7fec3b0e4000 ---p 00000000 00:00 0
7fec3b0e4000-7fec3b185000 rw-p 00000000 00:00 0
7fec3b185000-7fec3b186000 ---p 00000000 00:00 0
7fec3b186000-7fec3b227000 rw-p 00000000 00:00 0
7fec3b227000-7fec3b228000 ---p 00000000 00:00 0
7fec3b228000-7fec3b2c9000 rw-p 00000000 00:00 0
7fec3b2c9000-7fec3b2ca000 ---p 00000000 00:00 0
7fec3b2ca000-7fec3b36b000 rw-p 00000000 00:00 0
7fec3b36b000-7fec3b36c000 ---p 00000000 00:00 0
7fec3b36c000-7fec3b40d000 rw-p 00000000 00:00 0
7fec3b40d000-7fec3b40e000 ---p 00000000 00:00 0
7fec3b40e000-7fec3b4af000 rw-p 00000000 00:00 0
7fec3b4af000-7fec3b4b0000 ---p 00000000 00:00 0
7fec3b4b0000-7fec3b551000 rw-p 00000000 00:00 0
7fec3b551000-7fec3b552000 ---p 00000000 00:00 0
7fec3b552000-7fec3b5f3000 rw-p 00000000 00:00 0
7fec3b5f3000-7fec3b5f4000 ---p 00000000 00:00 0
7fec3b5f4000-7fec3b695000 rw-p 00000000 00:00 0
7fec3b695000-7fec3b696000 ---p 00000000 00:00 0
7fec3b696000-7fec3b737000 rw-p 00000000 00:00 0
7fec3b737000-7fec3b738000 ---p 00000000 00:00 0
7fec3b738000-7fec3d7e2000 rw-p 00000000 00:00 0
7fec3d811000-7fec3d814000 r--p 00000000 fe:01 362333                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fec3d814000-7fec3d825000 r-xp 00003000 fe:01 362333                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fec3d825000-7fec3d829000 r--p 00014000 fe:01 362333                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fec3d829000-7fec3d82a000 r--p 00017000 fe:01 362333                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fec3d82a000-7fec3d82b000 rw-p 00018000 fe:01 362333                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7fec3d833000-7fec3d834000 r--p 00000000 fe:01 435931                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/nonblock.so
7fec3d834000-7fec3d835000 r-xp 00001000 fe:01 435931                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/nonblock.so
7fec3d835000-7fec3d836000 r--p 00002000 fe:01 435931                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/nonblock.so
7fec3d836000-7fec3d837000 r--p 00002000 fe:01 435931                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/nonblock.so
7fec3d837000-7fec3d838000 rw-p 00003000 fe:01 435931                     /usr/local/lib/ruby/3.0.0/x86_64-linux/io/nonblock.so
7fec3d838000-7fec3d83a000 r--p 00000000 fe:01 435952                     /usr/local/lib/ruby/3.0.0/x86_64-linux/stringio.so
7fec3d83a000-7fec3d83f000 r-xp 00002000 fe:01 435952                     /usr/local/lib/ruby/3.0.0/x86_64-linux/stringio.so
7fec3d83f000-7fec3d841000 r--p 00007000 fe:01 435952                     /usr/local/lib/ruby/3.0.0/x86_64-linux/stringio.so
7fec3d841000-7fec3d842000 r--p 00008000 fe:01 435952                     /usr/local/lib/ruby/3.0.0/x86_64-linux/stringio.so
7fec3d842000-7fec3d843000 rw-p 00009000 fe:01 435952                     /usr/local/lib/ruby/3.0.0/x86_64-linux/stringio.so
7fec3d843000-7fec3d944000 rw-p 00000000 00:00 0
7fec3d944000-7fec3d999000 r--p 00000000 fe:01 362748                     /usr/lib/locale/C.UTF-8/LC_CTYPE
7fec3d999000-7fec3d99b000 rw-p 00000000 00:00 0
7fec3d99b000-7fec3d9aa000 r--p 00000000 fe:01 362340                     /lib/x86_64-linux-gnu/libm-2.31.so
7fec3d9aa000-7fec3da44000 r-xp 0000f000 fe:01 362340                     /lib/x86_64-linux-gnu/libm-2.31.so
7fec3da44000-7fec3dadd000 r--p 000a9000 fe:01 362340                     /lib/x86_64-linux-gnu/libm-2.31.so
7fec3dadd000-7fec3dade000 r--p 00141000 fe:01 362340                     /lib/x86_64-linux-gnu/libm-2.31.so
7fec3dade000-7fec3dadf000 rw-p 00142000 fe:01 362340                     /lib/x86_64-linux-gnu/libm-2.31.so
7fec3dadf000-7fec3dae1000 r--p 00000000 fe:01 362326                     /lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fec3dae1000-7fec3daf6000 r-xp 00002000 fe:01 362326                     /lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fec3daf6000-7fec3db10000 r--p 00017000 fe:01 362326                     /lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fec3db10000-7fec3db11000 r--p 00030000 fe:01 362326                     /lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fec3db11000-7fec3db12000 rw-p 00031000 fe:01 362326                     /lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7fec3db12000-7fec3db1a000 rw-p 00000000 00:00 0
7fec3db1a000-7fec3db1b000 r--p 00000000 fe:01 362327                     /lib/x86_64-linux-gnu/libdl-2.31.so
7fec3db1b000-7fec3db1d000 r-xp 00001000 fe:01 362327                     /lib/x86_64-linux-gnu/libdl-2.31.so
7fec3db1d000-7fec3db1e000 r--p 00003000 fe:01 362327                     /lib/x86_64-linux-gnu/libdl-2.31.so
7fec3db1e000-7fec3db1f000 r--p 00003000 fe:01 362327                     /lib/x86_64-linux-gnu/libdl-2.31.so
7fec3db1f000-7fec3db20000 rw-p 00004000 fe:01 362327                     /lib/x86_64-linux-gnu/libdl-2.31.so
7fec3db20000-7fec3db22000 rw-p 00000000 00:00 0
7fec3db22000-7fec3db2d000 r--p 00000000 fe:01 363059                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7fec3db2d000-7fec3db89000 r-xp 0000b000 fe:01 363059                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7fec3db89000-7fec3dba0000 r--p 00067000 fe:01 363059                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7fec3dba0000-7fec3dba1000 ---p 0007e000 fe:01 363059                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7fec3dba1000-7fec3dba2000 r--p 0007e000 fe:01 363059                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7fec3dba2000-7fec3dba3000 rw-p 0007f000 fe:01 363059                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.1
7fec3dba3000-7fec3dba6000 r--p 00000000 fe:01 362368                     /lib/x86_64-linux-gnu/librt-2.31.so
7fec3dba6000-7fec3dbaa000 r-xp 00003000 fe:01 362368                     /lib/x86_64-linux-gnu/librt-2.31.so
7fec3dbaa000-7fec3dbab000 r--p 00007000 fe:01 362368                     /lib/x86_64-linux-gnu/librt-2.31.so
7fec3dbab000-7fec3dbac000 ---p 00008000 fe:01 362368                     /lib/x86_64-linux-gnu/librt-2.31.so
7fec3dbac000-7fec3dbad000 r--p 00008000 fe:01 362368                     /lib/x86_64-linux-gnu/librt-2.31.so
7fec3dbad000-7fec3dbae000 rw-p 00009000 fe:01 362368                     /lib/x86_64-linux-gnu/librt-2.31.so
7fec3dbae000-7fec3dbb5000 r--p 00000000 fe:01 362364                     /lib/x86_64-linux-gnu/libpthread-2.31.so
7fec3dbb5000-7fec3dbc5000 r-xp 00007000 fe:01 362364                     /lib/x86_64-linux-gnu/libpthread-2.31.so
7fec3dbc5000-7fec3dbca000 r--p 00017000 fe:01 362364                     /lib/x86_64-linux-gnu/libpthread-2.31.so
7fec3dbca000-7fec3dbcb000 r--p 0001b000 fe:01 362364                     /lib/x86_64-linux-gnu/libpthread-2.31.so
7fec3dbcb000-7fec3dbcc000 rw-p 0001c000 fe:01 362364                     /lib/x86_64-linux-gnu/libpthread-2.31.so
7fec3dbcc000-7fec3dbd0000 rw-p 00000000 00:00 0
7fec3dbd0000-7fec3dbd3000 r--p 00000000 fe:01 362383                     /lib/x86_64-linux-gnu/libz.so.1.2.11
7fec3dbd3000-7fec3dbe4000 r-xp 00003000 fe:01 362383                     /lib/x86_64-linux-gnu/libz.so.1.2.11
7fec3dbe4000-7fec3dbea000 r--p 00014000 fe:01 362383                     /lib/x86_64-linux-gnu/libz.so.1.2.11
7fec3dbea000-7fec3dbeb000 ---p 0001a000 fe:01 362383                     /lib/x86_64-linux-gnu/libz.so.1.2.11
7fec3dbeb000-7fec3dbec000 r--p 0001a000 fe:01 362383                     /lib/x86_64-linux-gnu/libz.so.1.2.11
7fec3dbec000-7fec3dbed000 rw-p 0001b000 fe:01 362383                     /lib/x86_64-linux-gnu/libz.so.1.2.11
7fec3dbed000-7fec3dc12000 r--p 00000000 fe:01 362319                     /lib/x86_64-linux-gnu/libc-2.31.so
7fec3dc12000-7fec3dd5d000 r-xp 00025000 fe:01 362319                     /lib/x86_64-linux-gnu/libc-2.31.so
7fec3dd5d000-7fec3dda7000 r--p 00170000 fe:01 362319                     /lib/x86_64-linux-gnu/libc-2.31.so
7fec3dda7000-7fec3dda8000 ---p 001ba000 fe:01 362319                     /lib/x86_64-linux-gnu/libc-2.31.so
7fec3dda8000-7fec3ddab000 r--p 001ba000 fe:01 362319                     /lib/x86_64-linux-gnu/libc-2.31.so
7fec3ddab000-7fec3ddae000 rw-p 001bd000 fe:01 362319                     /lib/x86_64-linux-gnu/libc-2.31.so
7fec3ddae000-7fec3ddb2000 rw-p 00000000 00:00 0
7fec3ddb3000-7fec3ddba000 r--s 00000000 fe:01 363028                     /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7fec3ddba000-7fec3ddea000 r--p 00000000 fe:01 434715                     /usr/local/lib/libruby.so.3.0.2
7fec3ddea000-7fec3e08a000 r-xp 00030000 fe:01 434715                     /usr/local/lib/libruby.so.3.0.2
7fec3e08a000-7fec3e193000 r--p 002d0000 fe:01 434715                     /usr/local/lib/libruby.so.3.0.2
7fec3e193000-7fec3e19a000 r--p 003d8000 fe:01 434715                     /usr/local/lib/libruby.so.3.0.2
7fec3e19a000-7fec3e19d000 rw-p 003df000 fe:01 434715                     /usr/local/lib/libruby.so.3.0.2
7fec3e19d000-7fec3e1b0000 rw-p 00000000 00:00 0
7fec3e1b0000-7fec3e1b1000 r--p 00000000 fe:01 362307                     /lib/x86_64-linux-gnu/ld-2.31.so
7fec3e1b1000-7fec3e1d1000 r-xp 00001000 fe:01 362307                     /lib/x86_64-linux-gnu/ld-2.31.so
7fec3e1d1000-7fec3e1d9000 r--p 00021000 fe:01 362307                     /lib/x86_64-linux-gnu/ld-2.31.so
7fec3e1da000-7fec3e1db000 r--p 00029000 fe:01 362307                     /lib/x86_64-linux-gnu/ld-2.31.so
7fec3e1db000-7fec3e1dc000 rw-p 0002a000 fe:01 362307                     /lib/x86_64-linux-gnu/ld-2.31.so
7fec3e1dc000-7fec3e1dd000 rw-p 00000000 00:00 0
7ffef0faf000-7ffef17ae000 rw-p 00000000 00:00 0                          [stack]
7ffef17e0000-7ffef17e4000 r--p 00000000 00:00 0                          [vvar]
7ffef17e4000-7ffef17e6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]


Aborted

Happens in both debian-based and alpine-based dockerfiles
Is there anything missing or required additionally that is not mentioned?

YAML/Psych adapter

YAML (psych) uses a C extension that invokes IO#read to load data from a file directly, so it looks like this will need a custom adapter to work seamlessly with polyphony.

Here's a minimal test case:

require 'yaml'
require 'tempfile'
file = Tempfile.new
file << 'hello: world'
file.close

puts YAML.load_file(file) # {"hello"=>"world"}

require 'polyphony'
puts YAML.load_file(file) # false

Thread#join hangs

There's a possible race condition in Polyphony's implementation of Thread#join which causes it to hang.

compilation failure

Ruby: MRI 2.7.2p137 (manually compiled)
OS: GNU/Linux
C compiler: gcc 10.2.0

$ sudo gem i polyphony

Fetching polyphony-0.45.4.gem
Building native extensions. This could take a while...
ERROR:  Error installing polyphony:
	ERROR: Failed to build gem native extension.

    current directory: /usr/lib/ruby/gems/2.7.0/gems/polyphony-0.45.4/ext/polyphony
/usr/bin/ruby -I /usr/lib/ruby/2.7.0 -r ./siteconf20201003-3226-b8zqx0.rb extconf.rb
checking for unistd.h... yes
checking for linux/aio_abi.h... yes
checking for sys/select.h... yes
checking for port_event_t in poll.h... no
checking for sys/epoll.h... yes
checking for sys/event.h... no
checking for port_event_t in port.h... no
checking for sys/resource.h... yes
creating Makefile

current directory: /usr/lib/ruby/gems/2.7.0/gems/polyphony-0.45.4/ext/polyphony
make "DESTDIR=" clean

current directory: /usr/lib/ruby/gems/2.7.0/gems/polyphony-0.45.4/ext/polyphony
make "DESTDIR="
compiling event.c
compiling fiber.c
compiling libev.c
In file included from libev.c:2:
../libev/ev.c:511:48: warning: "/*" within comment [-Wcomment]
  511 | /*#define MIN_INTERVAL  0.00000095367431640625 /* 1/2**20, good till 2200 */
      |                                                 
In file included from libev.c:2:
../libev/ev.c: In function โ€˜ecb_binary32_to_binary16โ€™:
../libev/ev.c:1302:13: warning: comparison of integer expressions of different signedness: โ€˜unsigned intโ€™ and โ€˜intโ€™ [-Wsign-compare]
 1302 |       if (e < (14 - 24)) /* might not be sharp, but is good enough */
      |             ^
In file included from libev.c:2:
../libev/ev.c: At top level:
../libev/ev.c:1867:31: warning: โ€˜ev_default_loop_ptrโ€™ initialized and declared โ€˜externโ€™
 1867 |   EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */
      |                               ^~~~~~~~~~~~~~~~~~~
../libev/ev.c: In function โ€˜array_nextsizeโ€™:
../libev/ev.c:1978:19: warning: comparison of integer expressions of different signedness: โ€˜intโ€™ and โ€˜long unsigned intโ€™ [-Wsign-compare]
 1978 |   if (elem * ncur > MALLOC_ROUND - sizeof (void *) * 4)
      |                   ^
In file included from ../libev/ev.c:2745,
                 from libev.c:2:
../libev/ev_linuxaio.c: In function โ€˜linuxaio_pollโ€™:
../libev/ev_linuxaio.c:498:10: warning: suggest explicit braces to avoid ambiguous โ€˜elseโ€™ [-Wdangling-else]
  498 |       if (expect_false (res < 0))
      |          ^
In file included from libev.c:2:
../libev/ev.c: In function โ€˜ev_io_startโ€™:
../libev/ev.c:4017:34: warning: suggest parentheses around arithmetic in operand of โ€˜|โ€™ [-Wparentheses]
 4017 |   fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);
      |                        ~~~~~~~~~~^~~~~~~~~~~~~
../libev/ev.c: At top level:
../libev/ev.c:5271:27: warning: "/*" within comment [-Wcomment]
 5271 | /* EV_STAT     0x00001000 /* stat data changed */
      |                            
../libev/ev.c:5272:27: warning: "/*" within comment [-Wcomment]
 5272 | /* EV_EMBED    0x00010000 /* embedded event loop needs sweep */
      |                            
cc1: note: unrecognized command-line option โ€˜-Wno-self-assignโ€™ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option โ€˜-Wno-parentheses-equalityโ€™ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option โ€˜-Wno-constant-logical-operandโ€™ may have been intended to silence earlier diagnostics
compiling libev_backend.c
compiling polyphony.c
compiling polyphony_ext.c
compiling queue.c
compiling ring_buffer.c
compiling thread.c
compiling tracing.c
linking shared-object polyphony_ext.so
/usr/bin/ld: thread.o:/usr/lib/ruby/gems/2.7.0/gems/polyphony-0.45.4/ext/polyphony/thread.c:7: multiple definition of `ID_ivar_result'; fiber.o:/usr/lib/ruby/gems/2.7.0/gems/polyphony-0.45.4/ext/polyphony/fiber.c:6: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:262: polyphony_ext.so] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/lib/ruby/gems/2.7.0/gems/polyphony-0.45.4 for inspection.
Results logged to /usr/lib/ruby/gems/2.7.0/extensions/aarch64-linux/2.7.0/polyphony-0.45.4/gem_make.out

Perhaps the big hint may be these lines:

/usr/bin/ld: thread.o:/usr/lib/ruby/gems/2.7.0/gems/polyphony-0.45.4/ext/polyphony/thread.c:7: multiple definition of `ID_ivar_result'; fiber.o:/usr/lib/ruby/gems/2.7.0/gems/polyphony-0.45.4/ext/polyphony/fiber.c:6: first defined here

Possible race condition on trapped signals

The INT and TERM signals will be silently swallowed in the following circumstances:

  • Fiber A is runnable
  • Fiber B is running
  • INT signal is trapped while fiber B is running
  • The signal trap schedules fiber B with an Interrupt exception
  • Fiber A being already in the run queue is ran, and schedules fiber B (without an exception)
  • Fiber B is ran without an exception

The solution is to put fiber B at the front of the run queue, thus ensuring the exception will be raised.

Problems with concurrent-ruby

Hey there,
I found another issue. So I have a project, that is based on Rails, in particular ActiveSupport. This however depends on concurrent-ruby.
Now it seems to be a problem to have Polyphony work together with concurrent-ruby. My Stacktrace says the following

/home/me/.rvm/gems/ruby-2.7.2@test/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:38:in `synchronize': undefined method `owned?' for #<Polyphony::Mutex:0x0000557126478d70> (NoMethodError)
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/atomic/event.rb:42:in `initialize'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/synchronization/object.rb:59:in `new'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/synchronization/object.rb:59:in `new'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/immediate_executor.rb:22:in `initialize'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/synchronization/object.rb:59:in `new'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/synchronization/object.rb:59:in `new'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/queue_adapters/async_adapter.rb:88:in `initialize'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/queue_adapters/async_adapter.rb:36:in `new'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/queue_adapters/async_adapter.rb:36:in `initialize'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/queue_adapter.rb:37:in `new'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/queue_adapter.rb:37:in `queue_adapter='
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/queue_adapter.rb:14:in `block in <module:QueueAdapter>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activesupport-6.0.3.4/lib/active_support/concern.rb:122:in `class_eval'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activesupport-6.0.3.4/lib/active_support/concern.rb:122:in `append_features'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/base.rb:63:in `include'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/base.rb:63:in `<class:Base>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/base.rb:61:in `<module:ActiveJob>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/base.rb:15:in `<top (required)>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/test_helper.rb:34:in `<module:TestHelper>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/test_helper.rb:7:in `<module:ActiveJob>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/test_helper.rb:5:in `<top (required)>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activejob-6.0.3.4/lib/active_job/railtie.rb:35:in `block (2 levels) in <class:Railtie>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:51:in `each'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/actionpack-6.0.3.4/lib/action_dispatch/testing/integration.rb:641:in `block in <module:Behavior>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activesupport-6.0.3.4/lib/active_support/concern.rb:122:in `class_eval'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/activesupport-6.0.3.4/lib/active_support/concern.rb:122:in `append_features'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/actionpack-6.0.3.4/lib/action_dispatch/testing/integration.rb:672:in `include'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/actionpack-6.0.3.4/lib/action_dispatch/testing/integration.rb:672:in `<class:IntegrationTest>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/actionpack-6.0.3.4/lib/action_dispatch/testing/integration.rb:622:in `<module:ActionDispatch>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/actionpack-6.0.3.4/lib/action_dispatch/testing/integration.rb:12:in `<top (required)>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/railties-6.0.3.4/lib/rails/test_help.rb:10:in `<top (required)>'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
	from /home/me/.rvm/gems/ruby-2.7.2@test/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
       ...

It seems that Polyphony overwrites the Mutex Class of Concurrent-ruby. Does that make sense?

snooze in a loop prevents event selector from running

A vulnerability in the current Thread#switch_fiber implementation:

  • fiber a sleeps for x seconds
  • fiber b runs in a loop, does not create any watchers, and finally snoozes.

Since fiber b stays runnable the whole time, the event selector is starved and fiber a can never proceed.

Possible solutions:

  • always run the event loop (might seriously affect performance)
  • force running the event loop every x times of running Thread#switch_fiber
  • force running the event loop every x time interval (perhaps using ev_now())

TCPSocket#send doesn't accept flags argument

Polyphony's TCPSocket#send implementation does not accept flags as the normal stdlib API. Changes to be made:

  • Change all XXX#send methods to accept flags (and pass them on to the backend).
  • Change Backend#send method to accept flags instead of variable arity
  • Add a Backend#sendv method that accepts an array of strings, and flags
  • On libev backend - that's just an alias to Backend_writev
  • On io_uring, the array is joined and sent using Backend_send

Incompatibility with concurrent-ruby 1.1.6?

First of all, thanks for acting on my previous bug reports ๐Ÿ™
I'd love to send PRs myself but for now my knowledge of the project is limited and all I can do is try to find bugs of the surface :)

I've attempted to plug polyphony into a simple project with activesupport. Then I found that the process would hang right before exiting.

Steps to reproduce:

  1. Bump concurrent-ruby to 1.1.6
  2. Run the script:
require 'bundler/setup'
require 'polyphony'

require 'concurrent' # we don't really need this but it's here to simulate side effects of requiring active_support/all
  1. See the process hang.

I'm running it on ruby 2.6.5p114.

Downgrading concurrent-ruby to 1.1.5 is the current workaround.

Net::HTTP fails on HTTPS URLs

First reported in #27:

require 'polyphony'
require 'uri'
require 'net/http'

uri = URI("https://realiteq.net/?q=time")
p Net::HTTP.get_response(uri)

nested Fiber#stop does not work properly

f1 = spin do
  f2 = spin { sleep 60 }
  f3 = spin { sleep 60 }
  sleep 60
ensure
  f2.stop
  f3.stop
  puts "should reach here!"
end

sleep 1
f1.stop
snooze

does not print anything.

"Polyphony enables cross-thread communication using"...

Hello, this seems like an interesting project! I was just reading the documentation overview and spotted a cliffhanger:

https://github.com/digital-fabric/polyphony/blame/master/docs/getting-started/overview.md#L117

Nevertheless, Polyphony fully supports multithreading, with each thread having its own fiber run queue and its own libev event loop. In addition, Polyphony enables cross-thread communication using

What does Polyphony use for cross-thread communication? The suspense is killing me ๐Ÿ˜…

Allow child fibers to be detached

This in order to allow a child fiber to outlive its parent:

parent = spin do
  child = spin { do_something_really_important }
  child.detach
  # die
end

# child should continue running after parent has died
child.parent #=> Fiber.root

Add OOB hook to backend

  • We want to be able to do GC when the program is otherwise idle (maybe with an adjustable minimum duration between consecutive GC's.
  • We'd like to be able to perform other OOB actions - cleanup, lazy updating - when the program is not busy handling incoming requests.
Thread.current.idle_gc_period = 60
Thread.current.on_idle { do_some_lazy_stuff }
# or maybe
Thread.current.on_idle(period: 60) { cleanup }

io_uring backend doesn't work on Ruby 3.0

The io_uring backend doesn't work under Ruby 3.0. The problem seems to stem from the fact that in Ruby 3.0, sockets are created non-blocking by default: https://github.com/ruby/ruby/blame/78f188524f551c97b1a7a44ae13514729f1a21c7/ext/socket/init.c#L411-L434. This change was made as part of the work on the FiberScheduler interface.

Doing I/O on a non-blocking socket with io_uring will return EAGAIN just like a normal system call.

The workaround would be to do the opposite of what we do in the libev backend. Instead of making sure the io is not non-blocking, and set this to an instance variable on the io.

ResourcePool#acquire should be reentrant

Consider the following scenario:

PG = ResourcePool.new { ... }
PG.transaction do
  ...
  PG.query('select 1');

PG calls #acquire and then delegates the method call. In this case #acquire is called twice. It should return the same resource instance, otherwise it will be called on different resource instances.

Queue implementation is missing methods from the stock Queue class

Ruby docs:

First of all: close, closed?:

After the call to close completes, the following are true:

  • closed? will return true
  • close will be ignored.
  • calling enq/push/<< will raise a ClosedQueueError
  • when empty? is false, calling deq/pop/shift will return an object from the queue as usual.
  • when empty? is true, deq(false) will not suspend the thread and will return nil. deq(true) will raise a ThreadError.

ClosedQueueError is inherited from StopIteration, so that you can break loop block.

Also: any ongoing blocking call to shift/pop should return nil once the queue is closed.


Then we also have:

  • deq - alias for shift
  • enq - alias for push
  • length - alias for size
  • num_waiting - returns number of fibers currently waiting on queue
  • deq/pop should also accept an optional nonblock=false parameter.

Implement Fiber::SchedulerInterface

With the release of Ruby 3.0 and the new Fiber::SchedulerInterface for implementing non-blocking fibers, it seems that a consensus has formed around this new interface for building Fiber-based concurrent applications, and considering the programming model and API this project offers has very similar goals, I think it would be a smart move to pivot in alignment. It would be super useful to Ruby 3.0+ applications (and also extremely helpful for broader adoption of this library) if Polyphony could implement SchedulerInterface and allow its high-performance event-reactor implementation to be used via Fiber.set_scheduler in any Ruby 3 application (as an alternative to the evt or async implementations).

As a further thought, perhaps an interesting pivot for the rest of polyphony's set of stdlib extensions and patches could be to make it function as a Fiber-scheduler 'polyfill', allowing the existing extensions to IO, Kernel etc. to implement (at least parts of) the fiber-scheduler interface on pre-3.0 ruby versions. Having an API-compatible polyfill would allow libraries a smoother transition towards adopting non-blocking fibers without immediately requiring upgrades to Ruby 3.0. This might be trickier to sort out than a SchedulerInterface implementation but could have a significant impact if successful.

Mutex issue with asynchronous interrupts

There's a common issue with Ruby's ensure blocks where resources can leak (fail to clean up as expected) where an 'asynchronous interrupt' may cause a block to exit before executing critical cleanup code.

See Charles Nutter's (2008) post for a description of the issue as it relates to the use of Thread#raise / Thread#kill. This has even caused subtle bugs in Ruby's own Mutex / ConditionVariable implementations (see e.g. 14999.

It seems that Fiber switchpoints can trigger the same kinds of issues. Here is a small script that breaks Polyphony::Mutex along these lines (based on xx-using-a-mutex.rb):

require 'bundler/setup'
require 'polyphony'
require 'polyphony/core/sync'

def loop_it(number, lock)
  loop do
    sleep(rand * 0.2)
    lock.synchronize do
      raise "[#{number}] still locked by #{$locked}" if $locked
      puts "child #{number} has the lock"
      $locked = number
      sleep(rand * 0.05)
      $locked = nil
    end
  end
end

lock = Polyphony::Mutex.new
100.times do |i|
  Array.new(3) do |n|
    spin { loop_it(i*3 + n, lock) }
  end.tap{sleep 0.1}.each_with_index do |f, n|
    puts "Terminating #{i*3+n}"
    f.terminate
  end
end

Here's a sample run:

$ bundle exec ruby examples/core/xx-using-a-mutex.rb 
child 2 has the lock
child 0 has the lock
Terminating 0
Terminating 1
Terminating 2
child 3 has the lock
child 5 has the lock
Terminating 3
Terminating 4
Terminating 5
Traceback (most recent call last):
        10: from examples/core/xx-using-a-mutex.rb:21:in `<main>'
         9: from examples/core/xx-using-a-mutex.rb:21:in `times'
         8: from examples/core/xx-using-a-mutex.rb:22:in `block in <main>'
         7: from examples/core/xx-using-a-mutex.rb:22:in `new'
         6: from examples/core/xx-using-a-mutex.rb:22:in `initialize'
         5: from examples/core/xx-using-a-mutex.rb:23:in `block (2 levels) in <main>'
         4: from examples/core/xx-using-a-mutex.rb:23:in `block (3 levels) in <main>'
         3: from examples/core/xx-using-a-mutex.rb:8:in `loop_it'
         2: from examples/core/xx-using-a-mutex.rb:8:in `loop'
         1: from examples/core/xx-using-a-mutex.rb:10:in `block in loop_it'
examples/core/xx-using-a-mutex.rb:11:in `block (2 levels) in loop_it': [6] still locked by 5 (RuntimeError)

I wanted to raise this issue early since I think a good general solution to this problem in all places where ensure blocks are being used for resource cleanup will be crucial to the overall stability of this framework.

Redis adapter and blocking commands

I've been trying to see what breaks on Sidekiq and I found a bug related to blocking pop on Redis.

Here's the reproduction script that I've been running on the latest master:

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony/adapters/redis'

redis = Redis.new

redis.lpush("queue_key", "omgvalue")

puts "len: #{redis.llen("queue_key")}"

result = redis.blpop("queue_key")
puts result.inspect

You can see the script handing forever, even though it should be able to pop the value. It works fine if you replace blpop with plain lpop.

I tried to dig to see what happens there. All I found was that libev_io_wait waits fine for lpop but not for blpop. It's somewhere ev_io_stop that makes it blocked - but I don't get why because Redis protocol is identical for both commands.

osx, symbol not found in flat namespace '_Backend_close'

Hi there!
after upgrading from 0.73 to 0.75 I started to receive the error mentioned in the title.

osx 12.1 (21C52), ruby 2.7.3
the minimal reproducible example

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'polyphony', '0.75'
end

puts 'It works!'

leads to

ruby test_polyphony.rb
Traceback (most recent call last):
	11: from test_polyphony.rb:3:in `<main>'
	10: from /Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.23/lib/bundler/inline.rb:55:in `gemfile'
	9: from /Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.23/lib/bundler/settings.rb:131:in `temporary'
	8: from /Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.23/lib/bundler/inline.rb:71:in `block in gemfile'
	7: from /Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.23/lib/bundler/runtime.rb:50:in `require'
	6: from /Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.23/lib/bundler/runtime.rb:50:in `each'
	5: from /Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.23/lib/bundler/runtime.rb:61:in `block in require'
	4: from /Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.23/lib/bundler/runtime.rb:61:in `each'
	3: from /Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.23/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
	2: from /Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/bundler-2.2.23/lib/bundler/runtime.rb:66:in `require'
	1: from /Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/polyphony-0.75/lib/polyphony.rb:4:in `<top (required)>'
/Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/polyphony-0.75/lib/polyphony.rb:4:in `require_relative': dlopen(/Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/polyphony-0.75/lib/polyphony_ext.bundle, 0x0009): symbol not found in flat namespace '_Backend_close' - /Users/dmitrydedov/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/polyphony-0.75/lib/polyphony_ext.bundle (LoadError)

Sleeping fibers sometimes fail to terminate

Sometimes a fiber in a short sleep fails to terminate, here's a short test case that hangs on my machine:

require 'bundler/setup'
require 'polyphony'

1000.times do |n|
  spin do
    loop do
      sleep 0.01
    end
  end
end

sleep 0.1

Some extra debugging shows half of the fibers failing to terminate:

require 'bundler/setup'
require 'polyphony'

fibers = Array.new(1000) do |n|
  spin do
    loop do
      sleep 0.01
    end
  end
end

sleep 0.1
fibers.each(&:terminate)
until fibers.all? {|f| f.state == :dead}
  puts fibers.map(&:state).tally
  sleep 0.1
end
$ bundle exec ruby examples/core/xx-resource-pool.rb 
{:runnable=>1000}
{:dead=>500, :waiting=>500}
{:dead=>500, :waiting=>500}
{:dead=>500, :waiting=>500}
{:dead=>500, :waiting=>500}
{:dead=>500, :waiting=>442, :runnable=>58}
{:dead=>500, :waiting=>500}
{:dead=>500, :waiting=>500}
{:dead=>500, :waiting=>430, :runnable=>70}
{:dead=>500, :waiting=>401, :runnable=>99}
[...]

uninitialized stream (IOError)

When using polyphony and concurrent-ruby version 1.1.5. The net/http, faraday and httparty fails and raise:

ruby/2.7.1/lib/ruby/2.7.0/net/http.rb:1001:in `nonblock=': uninitialized stream (IOError)

When I upgrade concurrent-ruby to version 1.1.6 the problem with faraday and httparty gets fixed, but the script gets stuck in the request or something and it does not finish.

Gemfile

# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# gem "httparty", "~> 0.18.1"

# gem "faraday", "~> 1.0"

gem "concurrent-ruby", "~> 1.1.6"

gem "polyphony", "~> 0.43.4"

e.g. script.

Bundler.require(:default, :development)
require 'uri'
require 'net/http'

data = ::Concurrent::Array.new
urls = [
  'http://realiteq.net/?q=time'
]

def get_time(url)
  uri = URI(url)
  response = Net::HTTP.get(uri)
end

urls.each_slice(1) do |links|
  links.each do |link|
    fibers = ::Concurrent::Array.new
    puts " #{link}"
    fibers << spin do
      data << get_time(link)
    end
    Fiber.await(*fibers)
  end
end

puts "Finished"

Environment

  • ruby
    • ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
  • OS
    • Linux kali 5.6.0-kali2-amd64 #1 SMP Debian 5.6.14-2kali1 (2020-06-10) x86_64 GNU/Linux
  • OpenSSL
    • OpenSSL 1.1.1g 21 Apr 2020

Issues build on macOS / Ruby 2.6

On the current master branch, macOS 10.15.5, ruby 2.6.5p114.

...
6 warnings generated.
compiling libev_queue.c
compiling polyphony.c
compiling polyphony_ext.c
compiling socket.c
socket.c:155:14: warning: unused function 'Socket_accept' [-Wunused-function]
static VALUE Socket_accept(VALUE sock) {
             ^
1 warning generated.
compiling thread.c
compiling tracing.c
linking shared-object polyphony_ext.bundle
duplicate symbol '_ID_empty' in:
    polyphony.o
    thread.o
duplicate symbol '_ID_pop' in:
    polyphony.o
    thread.o
duplicate symbol '_ID_push' in:
    polyphony.o
    thread.o
ld: 3 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [polyphony_ext.bundle] Error 1

Any idea what could be wrong?

ResourcePool#acquire yields nil

Here's a bug in ResourcePool that popped up after switching the implementation to Queue (12744bd):

require 'bundler/setup'
require 'polyphony'
require 'polyphony/core/resource_pool'

count = 0
pool = Polyphony::ResourcePool.new(limit:9) {count += 1}

1000.times do
  spin do
    loop do
      pool.acquire do |x|
        raise 'nil' if x.nil?
        print x.to_s
        snooze
      end
    end
  end
end

sleep 1

The call to Queue#shift seems to have a race condition where it sometimes returns nil:

resource = @stock.shift

Replacing that line with snooze until (resource = @stock.shift) works around the issue but might not be the proper fix.

Unable to compile 0.65 with ruby 3.0.2 on Mac running 11.4

I am receiving the following when attempting to build 0.65 with ruby 3.0.2 on a Mac running 11.4

current directory: /usr/local/var/rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/polyphony-0.65/ext/polyphony
/usr/local/var/rbenv/versions/3.0.2/bin/ruby -I /usr/local/var/rbenv/versions/3.0.2/lib/ruby/3.0.0 -r ./siteconf20210730-2994-f0czo5.rb extconf.rb
checking for linux/aio_abi.h... no
checking for sys/select.h... yes
checking for port_event_t in poll.h... no
checking for sys/epoll.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for port_event_t in port.h... no
checking for sys/resource.h... yes
creating Makefile

current directory: /usr/local/var/rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/polyphony-0.65/ext/polyphony
make DESTDIR\= clean

current directory: /usr/local/var/rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/polyphony-0.65/ext/polyphony
make DESTDIR\=
compiling backend_common.c
backend_common.c:303:28: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
    .runqueue_max_length = runqueue_max_len(&base->runqueue),
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
backend_common.c:302:24: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
    .runqueue_length = runqueue_len(&base->runqueue),
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
backend_common.c:301:22: warning: implicit conversion loses integer precision: 'long' to 'unsigned int' [-Wshorten-64-to-32]
    .runqueue_size = runqueue_size(&base->runqueue),
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
compiling backend_io_uring.c
compiling backend_io_uring_context.c
compiling backend_libev.c
backend_libev.c:270:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    int current_len = RSTRING_LEN(str);
        ~~~~~~~~~~~   ^~~~~~~~~~~~~~~~
/usr/local/var/rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:44:27: note: expanded from macro 'RSTRING_LEN'
#define RSTRING_LEN       RSTRING_LEN
                          ^
backend_libev.c:488:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
  return INT2NUM(len);
         ~~~~~~~ ^~~
backend_libev.c:563:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
  return INT2NUM(total_written);
         ~~~~~~~ ^~~~~~~~~~~~~
backend_libev.c:780:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
  return INT2NUM(len);
         ~~~~~~~ ^~~
backend_libev.c:985:22: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
      total = left = n;
                   ~ ^
backend_libev.c:1064:16: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
        left = n;
             ~ ^
backend_libev.c:1367:13: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
  int len = RSTRING_LEN(str);
      ~~~   ^~~~~~~~~~~~~~~~
/usr/local/var/rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:44:27: note: expanded from macro 'RSTRING_LEN'
#define RSTRING_LEN       RSTRING_LEN
                          ^
backend_libev.c:1432:19: error: implicit declaration of function 'splice' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      chunk_len = splice(src_fptr->fd, 0, pipefd[1], 0, maxlen, 0);
                  ^
backend_libev.c:1458:15: error: implicit declaration of function 'splice' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      int n = splice(pipefd[0], 0, dest_fptr->fd, 0, left, 0);
              ^
7 warnings and 2 errors generated.
make: *** [backend_libev.o] Error 1

make failed, exit code 2

Problem handling Ctrl-C in IRB example

When running the irb example and sending a SIGINT with ^-C, libev complains:

Assertion failed: (("libev: ev_loop recursion during release detected", loop_done != EVBREAK_RECURSE)),
function ev_run, file ../../../../ext/gyro/../libev/ev.c, line 3656.
Abort trap: 6

This is because the default SIGINT will throw an exception while the ev_loop is running, causing libev to become all fudged up. From the libev docs:

Leaving ev_run abnormally (setjmp/longjmp, cancelling the thread, throwing an exception etc.), doesn't count as "exit" - consider this as a hint to avoid such ungentleman-like behaviour unless it's really convenient, in which case it is fully supported. libev docs.

Possible solutions:

  • install a SIGINT handler on each invocation of ev_run.
  • Remove the offending assert, and instead make the check and return early if needed:
if (loop_done == EVBREAK_RECURSE) {
  // the only way this should happen is if by any chance a signal was sent
  // while running the loop. The stock Ruby SIGINT handler behavior is to raise
  // an Interrupt exception, which leaves the ev_loop in an undefined state.
  // We get rid of the assert and instead try to reset the ev_loop state and
  // hope for the best.

  loop_done = EVBREAK_CANCEL;

#if EV_FEATURE_API
  --loop_depth;
#endif

  return 0;
}

Possible race condition in fiber-aware Mutex implementation

From the implementation:

def synchronize_not_holding
  @token = @store.shift
  @holding_fiber = Fiber.current
  yield
ensure
  @holding_fiber = nil
  @store << @token if @token
end

The ensure block will reset holding_fiber even if the call to @store.shift has raised an exception, possibly causing a race condition.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.