Skip to content

Threading issues when using tools like PyCharm/PyDev #80

@devm18426

Description

@devm18426

Steps to reproduce issue:

  • Run Python console in PyCharm
  • import STPyV8
  • Instantiate any class (for example: l = STYPyV8.JSLocker())
  • Confirm that running dir on the object works fine (for example: dir(l))
  • Try to enumerate the objects children (fields/methods) using the GUI (either through the watch panel or autocomplete)

This will result in a crash.

On Linux (using the latest release): Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
On Windows (using one of my builds): Process finished with exit code -1073741819 (0xC0000005)

Setting the PYTHONFAULTHANDLER environment variable ahead of time results in the following dumps:

Linux
Fatal Python error: Segmentation fault

Current thread 0x00007f4e1b63f700 (most recent call first):
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/_pydev_bundle/_pydev_imports_tipper.py", line 218 in generate_imports_tip_for_module
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/_pydev_bundle/_pydev_completer.py", line 151 in attr_matches
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/_pydev_bundle/_pydev_completer.py", line 89 in complete
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/_pydev_bundle/pydev_console_utils.py", line 274 in do_get_completions
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/_pydev_bundle/pydev_console_utils.py", line 281 in getCompletions
File "/snap/pycharm-professional/346/plugins/python/helpers/third_party/thriftpy/_shaded_thriftpy/thrift.py", line 287 in call
File "/snap/pycharm-professional/346/plugins/python/helpers/third_party/thriftpy/_shaded_thriftpy/thrift.py", line 321 in process
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/_pydev_comm/pydev_server.py", line 34 in handle
File "/usr/lib/python3.8/threading.py", line 870 in run
File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner
File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007f4e1be40700 (most recent call first):
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/_pydev_comm/pydev_io.py", line 110 in readall
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/_pydev_comm/pydev_transport.py", line 45 in _read_frame
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/_pydev_comm/pydev_transport.py", line 37 in _read_and_dispatch_next_frame
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/_pydev_comm/pydev_transport.py", line 64 in _read_forever
File "/usr/lib/python3.8/threading.py", line 870 in run
File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner
File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007f4e1d8ea740 (most recent call first):
File "/usr/lib/python3.8/threading.py", line 306 in wait
File "/usr/lib/python3.8/queue.py", line 179 in get
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/pydevconsole.py", line 278 in process_exec_queue
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/pydevconsole.py", line 498 in start_client
File "/snap/pycharm-professional/346/plugins/python/helpers/pydev/pydevconsole.py", line 570 in

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

Windows
Windows fatal exception: access violation
Current thread 0x00004500 (most recent call first):
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_resolver.py", line 178 in _getPyDictionary
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_resolver.py", line 86 in get_dictionary
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_vars.py", line 265 in _resolve_default_variable_fields
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_vars.py", line 373 in resolve_compound_var_object_fields
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_console_utils.py", line 200 in getVariable
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\third_party\thriftpy\_shaded_thriftpy\thrift.py", line 287 in call
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\third_party\thriftpy\_shaded_thriftpy\thrift.py", line 321 in process
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\_pydev_comm\pydev_server.py", line 34 in handle
  File "c:\python311\Lib\threading.py", line 975 in run
  File "c:\python311\Lib\threading.py", line 1038 in _bootstrap_inner
  File "c:\python311\Lib\threading.py", line 995 in _bootstrap
Thread 0x0000adb0 (most recent call first):
  File "c:\python311\Lib\threading.py", line 320 in wait
  File "c:\python311\Lib\threading.py", line 622 in wait
  File "...\Lib\site-packages\IPython\core\history.py", line 884 in run
  File "...\Lib\site-packages\IPython\core\history.py", line 60 in only_when_enabled
  File "...\Lib\site-packages\decorator.py", line 232 in fun
  File "c:\python311\Lib\threading.py", line 1038 in _bootstrap_inner
  File "c:\python311\Lib\threading.py", line 995 in _bootstrap
Thread 0x00009658 (most recent call first):
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\_pydev_comm\pydev_io.py", line 110 in readall
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\_pydev_comm\pydev_transport.py", line 45 in _read_frame
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\_pydev_comm\pydev_transport.py", line 37 in _read_and_dispatch_next_frame
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\_pydev_comm\pydev_transport.py", line 64 in _read_forever
  File "c:\python311\Lib\threading.py", line 975 in run
  File "c:\python311\Lib\threading.py", line 1038 in _bootstrap_inner
  File "c:\python311\Lib\threading.py", line 995 in _bootstrap
Thread 0x0000ebc4 (most recent call first):
  File "c:\python311\Lib\threading.py", line 324 in wait
  File "c:\python311\Lib\queue.py", line 180 in get
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\pydevconsole.py", line 278 in process_exec_queue
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\pydevconsole.py", line 496 in start_client
  File "C:\Program Files (x86)\JetBrains\PyCharm 2020.2.3\plugins\python\helpers\pydev\pydevconsole.py", line 568 in 
Process finished with exit code -1073741819 (0xC0000005)

I've concluded this issue has to do with multithreading since running dir on the object directly in the interpreter works fine. PyCharm/PyDev runs dir on a separate thread which fails.

Autocomplete in IPython that's run in a regular terminal (not through PyCharm) work fine. In this case the autocomplete (using dir as well) is generated in the same thread.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions