[parrot/parrot] 297f1e: [GH #881] Do not ignore the exit opcode argument, ...

GitHub noreply at github.com
Wed Dec 12 17:11:26 UTC 2012


  Branch: refs/heads/master
  Home:   https://github.com/parrot/parrot
  Commit: 297f1ee23b9fcdb70989df9cc68cafb8a89cb8f5
      https://github.com/parrot/parrot/commit/297f1ee23b9fcdb70989df9cc68cafb8a89cb8f5
  Author: Reini Urban <rurban at cpanel.net>
  Date:   2012-12-12 (Wed, 12 Dec 2012)

  Changed paths:
    M src/exceptions.c
    M t/pmc/task.t

  Log Message:
  -----------
  [GH #881] Do not ignore the exit opcode argument, fix t/pmc/task.t

The argument for the exit op is ignored, parrot always exits with 1.

die_from_exception() uses Parrot_x_jump_out(interp, 1); even if the given exit_code was 0
(branch severity == EXCEPT_exit)

t/pmc/task.t cannot use test_more as ok updates the counter in a non-thread safe way.
we also cannot use say as say is non-atomic, the final \n can be printed after the concurrent thread
prints its line.
sleep is also concurrent, so better use a poor mans busy sleep to wait to the task to be killed.
The numbers seem to stable now, tested on a pretty fast multicore machine.


  Commit: 792763b089f9a809bb39178747dace64c16c7b4b
      https://github.com/parrot/parrot/commit/792763b089f9a809bb39178747dace64c16c7b4b
  Author: Reini Urban <rurban at cpanel.net>
  Date:   2012-12-12 (Wed, 12 Dec 2012)

  Changed paths:
    M src/pmc/task.pmc

  Log Message:
  -----------
  Fix a threads race condition with Task_nci_send/Task_invoke

Postpone TASK_recv_block_CLEAR(partner) when another task wants to check
!TASK_in_preempt_TEST(_self)

$ tsan ./parrot t/pmc/task.t
==6406== ThreadSanitizer, a data race detector
1..8
ok 1 - initialized
ok 2 task1 ran
ok 3 task2 ran
ok 4 sub1 ran
==6406== INFO: T2 has been created by T0. Use --announce-threads to see the creation stack.
==6406== INFO: T0 is program's main thread
==6406== WARNING: Possible data race during write of size 8 at 0x43A6218: {{{
==6406==    T0 (L{L31}):
==6406==     #0  Parrot_Task_nci_send /usr/src/parrot/master/src/pmc/task.c:316
==6406==     #1  Parrot_NativePCCMethod_invoke /usr/src/parrot/master/src/pmc/nativepccmethod.c:122
==6406==     #2  Parrot_callmethodcc_p_sc /usr/src/parrot/master/src/ops/core_ops.c:18300
==6406==     #3  runops_fast_core /usr/src/parrot/master/src/runcore/cores.c:499
==6406==     #4  runops_int /usr/src/parrot/master/src/runcore/main.c:220
==6406==     #5  runops /usr/src/parrot/master/src/call/ops.c:123
==6406==     #6  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:338
==6406==     #7  Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==6406==     #8  Parrot_Task_invoke /usr/src/parrot/master/src/pmc/task.c:168
==6406==     #9  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:330
==6406==     #10 Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==6406==     #11 Parrot_cx_next_task /usr/src/parrot/master/src/scheduler.c:231
==6406==   Concurrent read(s) happened at (OR AFTER) these points:
==6406==    T2 (L{}):
==6406==     #0  Parrot_Task_invoke /usr/src/parrot/master/src/pmc/task.c:175
==6406==     #1  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:330
==6406==     #2  Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==6406==     #3  Parrot_cx_next_task /usr/src/parrot/master/src/scheduler.c:231
==6406==     #4  Parrot_thread_outer_runloop /usr/src/parrot/master/src/thread.c:322
==6406==   Location 0x43A6218 is 1544 bytes inside a block starting at 0x43A5C10 of size 4096 allocated by T0 from heap:
==6406==     #0  calloc /mnt/data/build/slave/full_linux_build/build/tsan/ts_valgrind_intercepts.c:444
==6406==     #1  mem_sys_allocate_zeroed /usr/src/parrot/master/src/gc/alloc_memory.c:97
==6406==     #2  allocate_new_pool_arena /usr/src/parrot/master/src/gc/fixed_allocator.c:547
==6406==     #3  pool_allocate /usr/src/parrot/master/src/gc/fixed_allocator.c:448
==6406==     #4  Parrot_gc_pool_allocate /usr/src/parrot/master/src/gc/fixed_allocator.c:344
==6406==     #5  gc_gms_allocate_pmc_header /usr/src/parrot/master/src/gc/gc_gms.c:1490
==6406==     #6  Parrot_gc_new_pmc_header /usr/src/parrot/master/src/gc/api.c:312
==6406==     #7  get_new_pmc_header /usr/src/parrot/master/src/pmc.c:571
==6406==     #8  Parrot_pmc_new_init /usr/src/parrot/master/src/pmc.c:630
==6406==     #9  Parrot_thread_create_proxy /usr/src/parrot/master/src/thread.c:156
==6406==   Locks involved in this report (reporting last lock sites): {L31}
==6406==    L31 (0x42F02A8)
==6406==     #0  pthread_mutex_lock /mnt/data/build/slave/full_linux_build/build/tsan/ts_valgrind_intercepts.c:935
==6406==     #1  Parrot_Task_nci_send /usr/src/parrot/master/src/pmc/task.c:312
==6406==     #2  Parrot_NativePCCMethod_invoke /usr/src/parrot/master/src/pmc/nativepccmethod.c:122
==6406==     #3  Parrot_callmethodcc_p_sc /usr/src/parrot/master/src/ops/core_ops.c:18300
==6406==     #4  runops_fast_core /usr/src/parrot/master/src/runcore/cores.c:499
==6406==     #5  runops_int /usr/src/parrot/master/src/runcore/main.c:220
==6406==     #6  runops /usr/src/parrot/master/src/call/ops.c:123
==6406==     #7  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:338
==6406==     #8  Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==6406==     #9  Parrot_Task_invoke /usr/src/parrot/master/src/pmc/task.c:168
==6406==     #10 Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:330
==6406==     #11 Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==6406==    Race verifier data: 0x5168EC1,0x516785D
==6406== }}}
ok 5 Got message after block
ok 6 Got existing message
ok 7 task_to_kill running
ok 8 task_to_kill killed
==6406==
==6406== ThreadSanitizer summary: reported 1 warning(s) (1 race(s))


  Commit: 79e84c9b56a0d0908e4fbd739da8291570dd843b
      https://github.com/parrot/parrot/commit/79e84c9b56a0d0908e4fbd739da8291570dd843b
  Author: Reini Urban <rurban at cpanel.net>
  Date:   2012-12-12 (Wed, 12 Dec 2012)

  Changed paths:
    M src/alarm.c

  Log Message:
  -----------
  Fix a thread race condition in Parrot_alarm_runloop

Racy write with read in Parrot_alarm_check, lock alarm_serial += 1;

$ tsan ./parrot t/pmc/task.t
ok 9 pre-empt and exit
==18766== INFO: T0 is program's main thread
==18766== INFO: T1 has been created by T0. Use --announce-threads to see the creation stack.
==18766== WARNING: Possible data race during write of size 8 at 0x5322580: {{{
==18766==    T1 (L{}):
==18766==     #0  Parrot_alarm_runloop /usr/src/parrot/master/src/alarm.c:129
==18766==   Concurrent read(s) happened at (OR AFTER) these points:
==18766==    T0 (L{}):
==18766==     #0  Parrot_alarm_check /usr/src/parrot/master/src/alarm.c:154
==18766==     #1  Parrot_cx_check_scheduler /usr/src/parrot/master/src/scheduler.c:253
==18766==     #2  Parrot_branch_ic /usr/src/parrot/master/src/ops/core_ops.c:13735
==18766==     #3  runops_fast_core /usr/src/parrot/master/src/runcore/cores.c:499
==18766==     #4  runops_int /usr/src/parrot/master/src/runcore/main.c:220
==18766==     #5  runops /usr/src/parrot/master/src/call/ops.c:123
==18766==     #6  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:338
==18766==     #7  Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==18766==     #8  Parrot_Task_invoke /usr/src/parrot/master/src/pmc/task.c:168
==18766==     #9  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:330
==18766==   Address 0x5322580 is 0 bytes inside data symbol "alarm_serial"
==18766==    Race verifier data: 0x4FEC3AE,0x4FEC3FB
==18766== }}}


  Commit: 9f167b1577b6d5f90c93e98aa65b817d748455ef
      https://github.com/parrot/parrot/commit/9f167b1577b6d5f90c93e98aa65b817d748455ef
  Author: Reini Urban <rurban at cpanel.net>
  Date:   2012-12-12 (Wed, 12 Dec 2012)

  Changed paths:
    M docs/pdds/pdd25_concurrency.pod

  Log Message:
  -----------
  [doc] Update pdd25_concurrency (a bit)

Hilight our current hybrid threading model.

Several methods are missing:
e.g. wait TASK, threaded writes, Task send, invoke,
pass


  Commit: 6bf73b5b80cfa2e95b3c4861f8c787270fcca59e
      https://github.com/parrot/parrot/commit/6bf73b5b80cfa2e95b3c4861f8c787270fcca59e
  Author: Reini Urban <rurban at cpanel.net>
  Date:   2012-12-12 (Wed, 12 Dec 2012)

  Changed paths:
    M runtime/parrot/include/test_more.pir
    M runtime/parrot/library/Test/Builder.pir

  Log Message:
  -----------
  [doc] mark test_more, Test::Builder as not thread-safe

The counter updates need to be schedule_proxied in the parent task


  Commit: a094961ca40b3748a5d4035e9e87df42ebcf4fbc
      https://github.com/parrot/parrot/commit/a094961ca40b3748a5d4035e9e87df42ebcf4fbc
  Author: Reini Urban <rurban at cpanel.net>
  Date:   2012-12-12 (Wed, 12 Dec 2012)

  Changed paths:
    M src/pmc/parrotinterpreter.pmc

  Log Message:
  -----------
  Revive ParrotInterpreter.get_integer to return the thread id

This was disabled with the kill_threads branch, end of 2011


  Commit: 8848658feb9ee739684151d369c74459d0c53702
      https://github.com/parrot/parrot/commit/8848658feb9ee739684151d369c74459d0c53702
  Author: Reini Urban <rurban at cpanel.net>
  Date:   2012-12-12 (Wed, 12 Dec 2012)

  Changed paths:
    M lib/Parrot/Pmc2c/Method.pm

  Log Message:
  -----------
  [pmc2c] detect more empty bodies


Compare: https://github.com/parrot/parrot/compare/32ac823ed6b4...8848658feb9e


More information about the parrot-commits mailing list