Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vfx missing in 2d examples #12

Closed
MidoriYakumo opened this issue Jan 7, 2017 · 5 comments
Closed

vfx missing in 2d examples #12

MidoriYakumo opened this issue Jan 7, 2017 · 5 comments

Comments

@MidoriYakumo
Copy link

MidoriYakumo commented Jan 7, 2017

/taichi/python/examples/2d   master ●  for fn in *.py; do echo $fn;python3 $fn;done
color_schemes.py
composer.py
fluid_simulator.py
Traceback (most recent call last):
  File "fluid_simulator.py", line 1, in <module>
    from .levelset import LevelSet2D
SystemError: Parent module '' not loaded, cannot perform relative import
__init__.py
levelset.py
mcmc.py
16 @9.9999%
^CTraceback (most recent call last):
  File "mcmc.py", line 150, in <module>
    mh()
  File "mcmc.py", line 27, in mh
    acceptance = min(eval(y) / eval(x), 1)
KeyboardInterrupt
mpm_simulator.py
Traceback (most recent call last):
  File "mpm_simulator.py", line 3, in <module>
    from .levelset import LevelSet2D
SystemError: Parent module '' not loaded, cannot perform relative import
polygons.py
run_fluid_fancy.py
Traceback (most recent call last):
  File "run_fluid_fancy.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_fluid.py
Traceback (most recent call last):
  File "run_fluid.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_levelset.py
Traceback (most recent call last):
  File "run_levelset.py", line 1, in <module>
    import pyglet
ImportError: No module named 'pyglet'
run_mpm_balance.py
Traceback (most recent call last):
  File "run_mpm_balance.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_mpm_elastic.py
Traceback (most recent call last):
  File "run_mpm_elastic.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_mpm_sand_friction_angle.py
Traceback (most recent call last):
  File "run_mpm_sand_friction_angle.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_mpm_sand_hourglass.py
Traceback (most recent call last):
  File "run_mpm_sand_hourglass.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_mpm_sand.py
Traceback (most recent call last):
  File "run_mpm_sand.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_mpm_snow.py
Traceback (most recent call last):
  File "run_mpm_snow.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_mpm_snow_smash.py
Traceback (most recent call last):
  File "run_mpm_snow_smash.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_mpm_snow_sticky.py
Traceback (most recent call last):
  File "run_mpm_snow_sticky.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_mpm_title.py
Traceback (most recent call last):
  File "run_mpm_title.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_mpm_tree.py
Traceback (most recent call last):
  File "run_mpm_tree.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_mpm_words.py
Traceback (most recent call last):
  File "run_mpm_words.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_smoke_ball.py
Traceback (most recent call last):
  File "run_smoke_ball.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
run_smoke.py
Traceback (most recent call last):
  File "run_smoke.py", line 1, in <module>
    from taichi.vfx import *
ImportError: No module named 'taichi.vfx'
simulation_window.py
Traceback (most recent call last):
  File "simulation_window.py", line 4, in <module>
    import pyglet
ImportError: No module named 'pyglet'
simulator.py
@yuanming-hu
Copy link
Member

Thanks. I wrote the 2d scripts a long time ago and now they are completely in a mess. I'll fix them as soon as possible.

@iamyoukou
Copy link

@MidoriYakumo You can modify some files to run those examples.
For example, if you want to run run_mpm_snow.py

  1. in taichi/python/misc/2d/levelset.py
    add import taichi_core as tc
  2. in taichi/python/misc/2d/run_mpm_snow.py
#from taichi.vfx import *
from mpm_simulator import *
from simulation_window import SimulationWindow
from color_schemes import *
  1. in taichi/python/misc/2d/simulatio_window.py
#from taichi.misc.util import get_os_name
from taichi.misc.util import *

and change VIDEO_OUTPUT_ROOT in get_os_name function to the path you like.

  1. in taichi/python/taichi/misc/util.py
    @IteratorAdvance
    On MacOSX, I
import taichi_core as tc # on my Arch Linux, this causes segmentation fault (core dumped)
import pyglet

so, on Arch Linux, I

import pyglet

and

def make_polygon(points, scale):
    import taichi_core as tc # add here
    polygon = tc.Vector2List()
def const_or_evaluate(f, u, v):
    import taichi_core as tc # add here
    if type(f) in [float, int, tuple, tc.Vector2, tc.Vector3]:
  1. in ~/.bashrc
    add $TAICHI_ROOT_DIR/taichi/build/ (for taichi_core.so)
    and $TAICHI_ROOT_DIR/taichi/python/misc/2d/
    to your PYTHONPATH environment variable

I tried this method on MacOSX (10.11.6) and Arch Linux (4.8.13) and it works well.
This works for run_mpm_snow_smash.py and run_mpm_snow_sticky.py, too.

@yuanming-hu
Copy link
Member

Hi @iamyoukou, It's like magic for me that you get these scripts working...I haven't touched them for more than one month, during which period Taichi was under drastic refactoring. Thank you very much.

I've fixed the 2D MPM examples (in a dirty way) and will fix fluid ones later, since they need dependency on ANN, which I would like to remove.

You are welcome to contribute on issues with tag 'contributions welcome', and I will probably deal with the rest myself - just because I'm more familiar with my own legacy (dirty) code and you don't have to waste your precious time on these historical problems.

@iamyoukou
Copy link

Gotcha : )

@yuanming-hu
Copy link
Member

I've fixed all the examples. Thanks.

feisuzhu added a commit that referenced this issue Jan 12, 2023
Related Issue: #7140 

### Brief Summary

On macOS, when test worker hard fails (abort, EXC_BAD_ACCESS, etc.),
backward_cpp's signal handler will re-raise the signal and catch it
afterwards, make it an infinite loop, at the moment the offending
process can't be terminated easily (except a SIGKILL), eat CPU cycles
and blocks test runner.

```
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00000001a04f0e28 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #2: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #3: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #4: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #5: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #6: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #7: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #8: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #9: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #10: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #11: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #12: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #13: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #14: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #15: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #16: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #17: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #18: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #19: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #20: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #21: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #22: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #23: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #24: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #25: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #26: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #27: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #28: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #29: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #30: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #31: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #32: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #33: 0x00000001a046b454 libsystem_c.dylib`abort + 124
    frame #34: 0x0000000100194fc0 python`os_abort + 12
    frame #35: 0x00000001000758a8 python`cfunction_vectorcall_NOARGS + 324
    frame #36: 0x00000001001140f0 python`call_function + 460
    frame #37: 0x000000010011086c python`_PyEval_EvalFrameDefault + 27176
    frame #38: 0x00000001000287e4 python`function_code_fastcall + 128
    frame #39: 0x0000000100028008 python`PyVectorcall_Call + 120
    frame #40: 0x0000000100110b20 python`_PyEval_EvalFrameDefault + 27868
    frame #41: 0x000000010010982c python`_PyEval_EvalCodeWithName + 3008
    frame #42: 0x0000000100028948 python`_PyFunction_Vectorcall + 208
    frame #43: 0x0000000100028008 python`PyVectorcall_Call + 120
```
lin-hitonami pushed a commit that referenced this issue Jan 12, 2023
Related Issue: #7140 

### Brief Summary

On macOS, when test worker hard fails (abort, EXC_BAD_ACCESS, etc.),
backward_cpp's signal handler will re-raise the signal and catch it
afterwards, make it an infinite loop, at the moment the offending
process can't be terminated easily (except a SIGKILL), eat CPU cycles
and blocks test runner.

```
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00000001a04f0e28 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #2: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #3: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #4: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #5: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #6: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #7: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #8: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #9: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #10: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #11: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #12: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #13: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #14: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #15: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #16: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #17: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #18: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #19: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #20: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #21: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #22: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #23: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #24: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #25: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #26: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #27: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #28: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #29: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #30: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #31: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #32: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #33: 0x00000001a046b454 libsystem_c.dylib`abort + 124
    frame #34: 0x0000000100194fc0 python`os_abort + 12
    frame #35: 0x00000001000758a8 python`cfunction_vectorcall_NOARGS + 324
    frame #36: 0x00000001001140f0 python`call_function + 460
    frame #37: 0x000000010011086c python`_PyEval_EvalFrameDefault + 27176
    frame #38: 0x00000001000287e4 python`function_code_fastcall + 128
    frame #39: 0x0000000100028008 python`PyVectorcall_Call + 120
    frame #40: 0x0000000100110b20 python`_PyEval_EvalFrameDefault + 27868
    frame #41: 0x000000010010982c python`_PyEval_EvalCodeWithName + 3008
    frame #42: 0x0000000100028948 python`_PyFunction_Vectorcall + 208
    frame #43: 0x0000000100028008 python`PyVectorcall_Call + 120
```
lin-hitonami pushed a commit that referenced this issue Jan 12, 2023
Related Issue: #7140 

### Brief Summary

On macOS, when test worker hard fails (abort, EXC_BAD_ACCESS, etc.),
backward_cpp's signal handler will re-raise the signal and catch it
afterwards, make it an infinite loop, at the moment the offending
process can't be terminated easily (except a SIGKILL), eat CPU cycles
and blocks test runner.

```
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00000001a04f0e28 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #2: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #3: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #4: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #5: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #6: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #7: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #8: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #9: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #10: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #11: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #12: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #13: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #14: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #15: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #16: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #17: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #18: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #19: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #20: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #21: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #22: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #23: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #24: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #25: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #26: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #27: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #28: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #29: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #30: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #31: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #32: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #33: 0x00000001a046b454 libsystem_c.dylib`abort + 124
    frame #34: 0x0000000100194fc0 python`os_abort + 12
    frame #35: 0x00000001000758a8 python`cfunction_vectorcall_NOARGS + 324
    frame #36: 0x00000001001140f0 python`call_function + 460
    frame #37: 0x000000010011086c python`_PyEval_EvalFrameDefault + 27176
    frame #38: 0x00000001000287e4 python`function_code_fastcall + 128
    frame #39: 0x0000000100028008 python`PyVectorcall_Call + 120
    frame #40: 0x0000000100110b20 python`_PyEval_EvalFrameDefault + 27868
    frame #41: 0x000000010010982c python`_PyEval_EvalCodeWithName + 3008
    frame #42: 0x0000000100028948 python`_PyFunction_Vectorcall + 208
    frame #43: 0x0000000100028008 python`PyVectorcall_Call + 120
```
lin-hitonami pushed a commit that referenced this issue Jan 12, 2023
Related Issue: #7140 

### Brief Summary

On macOS, when test worker hard fails (abort, EXC_BAD_ACCESS, etc.),
backward_cpp's signal handler will re-raise the signal and catch it
afterwards, make it an infinite loop, at the moment the offending
process can't be terminated easily (except a SIGKILL), eat CPU cycles
and blocks test runner.

```
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00000001a04f0e28 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #2: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #3: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #4: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #5: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #6: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #7: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #8: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #9: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #10: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #11: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #12: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #13: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #14: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #15: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #16: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #17: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #18: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #19: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #20: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #21: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #22: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #23: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #24: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #25: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #26: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #27: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame #28: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #29: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #30: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame #31: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame #32: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame #33: 0x00000001a046b454 libsystem_c.dylib`abort + 124
    frame #34: 0x0000000100194fc0 python`os_abort + 12
    frame #35: 0x00000001000758a8 python`cfunction_vectorcall_NOARGS + 324
    frame #36: 0x00000001001140f0 python`call_function + 460
    frame #37: 0x000000010011086c python`_PyEval_EvalFrameDefault + 27176
    frame #38: 0x00000001000287e4 python`function_code_fastcall + 128
    frame #39: 0x0000000100028008 python`PyVectorcall_Call + 120
    frame #40: 0x0000000100110b20 python`_PyEval_EvalFrameDefault + 27868
    frame #41: 0x000000010010982c python`_PyEval_EvalCodeWithName + 3008
    frame #42: 0x0000000100028948 python`_PyFunction_Vectorcall + 208
    frame #43: 0x0000000100028008 python`PyVectorcall_Call + 120
```
quadpixels pushed a commit to quadpixels/taichi that referenced this issue May 13, 2023
Related Issue: taichi-dev#7140 

### Brief Summary

On macOS, when test worker hard fails (abort, EXC_BAD_ACCESS, etc.),
backward_cpp's signal handler will re-raise the signal and catch it
afterwards, make it an infinite loop, at the moment the offending
process can't be terminated easily (except a SIGKILL), eat CPU cycles
and blocks test runner.

```
(lldb) bt
* thread taichi-dev#1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00000001a04f0e28 libsystem_kernel.dylib`__pthread_kill + 8
    frame taichi-dev#1: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame taichi-dev#2: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame taichi-dev#3: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame taichi-dev#4: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame taichi-dev#5: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame taichi-dev#6: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame taichi-dev#7: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame taichi-dev#8: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame taichi-dev#9: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame taichi-dev#10: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame taichi-dev#11: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame taichi-dev#12: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame taichi-dev#13: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame taichi-dev#14: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame taichi-dev#15: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame taichi-dev#16: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame taichi-dev#17: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame taichi-dev#18: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame taichi-dev#19: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame taichi-dev#20: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame taichi-dev#21: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame taichi-dev#22: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame taichi-dev#23: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame taichi-dev#24: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame taichi-dev#25: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame taichi-dev#26: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame taichi-dev#27: 0x00000001283a0848 taichi_python.cpython-38-darwin.so`backward::SignalHandling::sig_handler(int, __siginfo*, void*) + 28
    frame taichi-dev#28: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame taichi-dev#29: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame taichi-dev#30: 0x00000001a0402e10 libsystem_c.dylib`raise + 32
    frame taichi-dev#31: 0x00000001a056ec44 libsystem_platform.dylib`_sigtramp + 56
    frame taichi-dev#32: 0x00000001a052343c libsystem_pthread.dylib`pthread_kill + 292
    frame taichi-dev#33: 0x00000001a046b454 libsystem_c.dylib`abort + 124
    frame taichi-dev#34: 0x0000000100194fc0 python`os_abort + 12
    frame taichi-dev#35: 0x00000001000758a8 python`cfunction_vectorcall_NOARGS + 324
    frame taichi-dev#36: 0x00000001001140f0 python`call_function + 460
    frame taichi-dev#37: 0x000000010011086c python`_PyEval_EvalFrameDefault + 27176
    frame taichi-dev#38: 0x00000001000287e4 python`function_code_fastcall + 128
    frame taichi-dev#39: 0x0000000100028008 python`PyVectorcall_Call + 120
    frame taichi-dev#40: 0x0000000100110b20 python`_PyEval_EvalFrameDefault + 27868
    frame taichi-dev#41: 0x000000010010982c python`_PyEval_EvalCodeWithName + 3008
    frame taichi-dev#42: 0x0000000100028948 python`_PyFunction_Vectorcall + 208
    frame taichi-dev#43: 0x0000000100028008 python`PyVectorcall_Call + 120
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants