Jinmo / idapkg

Packages for IDA Pro (written in python but supports all)
MIT License
131 stars 16 forks source link

RuntimeError: Function can be called from the main thread only #6

Closed bruce30262 closed 5 years ago

bruce30262 commented 5 years ago

While I was installing idapkg in IDA 7.2, I ran into some error with the following error messages:

Downloading idapkg...
Generating initial config at C:\<omit>\idapkg\config.json
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Python27\Lib\threading.py", line 801, in __bootstrap_inner
    self.run()
  File "C:\Python27\Lib\threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "<string>", line 2, in b
  File "c:\<omit>\appdata\local\temp\tmpcgndtj.zip\idapkg-0.1.0\pkg\__init__.py", line 4, in <module>
  File "c:\<omit>\appdata\local\temp\tmpcgndtj.zip\idapkg-0.1.0\pkg\commands.py", line 4, in <module>
  File "c:\<omit>\appdata\local\temp\tmpcgndtj.zip\idapkg-0.1.0\pkg\package.py", line 22, in <module>
  File "c:\<omit>\appdata\local\temp\tmpcgndtj.zip\idapkg-0.1.0\pkg\env.py", line 79, in <module>
  File "c:\<omit>\appdata\local\temp\tmpcgndtj.zip\idapkg-0.1.0\pkg\env.py", line 35, in __load_version_from_ida
  File "C:\Program Files\IDA 7.2\python\ida_kernwin.py", line 895, in get_kernel_version
    return _ida_kernwin.get_kernel_version(*args)
RuntimeError: Function can be called from the main thread only

I think it is similar to this issue

I think it's because IDA 7.2 introduced checks for IDA API functions to make sure they can only be called from the main thread.

IDAPython: all functions not marked as THREAD_SAFE in the C++ SDK, will now check that they are being called from the main thread, avoiding possible corruption or crashes

Jinmo commented 5 years ago

Hello, and thanks for the report! I'm fixing this function at util.py on the next release to make it reliable enough that pkg.env can use it, since it sometime fails or hangs.

Jinmo commented 5 years ago

(Fixing the bug is taking a longer time than I expected... Temporarily you can execute b() instead of Thread(target=b).start() and force-close ida and restart it again few times and taskkill it)

Jinmo commented 5 years ago

Fixed in 82936fa . Again, thanks for the report!