abrasic / blendpresence

Discord RPC support for Blender 3.0
GNU General Public License v3.0
224 stars 15 forks source link

The addon freezes Blender when it tries to load it. #12

Open inkoalawetrust opened 2 years ago

inkoalawetrust commented 2 years ago

I'm not sure how this is happening, but ever since today, the addon has caused my Blender installation to freeze. It causes Blender to hang when it tries to load it on startup, or if you try enabling it on the preferences window. Even trying to open my previous versions of 2.93 and 3.2 caused the same problem. The only way to stop the freezing was for me to remove it from the scripts folder so Blender can't find it and load it while it's using my main config.

I have no idea why that is happening, or why it spontaneously begun just today. But it did make me think that somehow my userpref.blend file was retroactively corrupted.

Here is the script of the addon from the appdata scripts folder for 3.3, along with my preferences file too. In case that can help you troubleshoot this bizarre bug.

Prefs and addon.zip

abrasic commented 2 years ago

Hi, thanks for your report and I apologize for the issue you've been facing. Unfortunately, I have not been able to reproduce it so far.

From the zip you provided, it appears you aren't using the latest version (you are using 1.7.1, the latest is 1.8.0). It's also important to note that an active internet connection is required in order for the add-on to properly make calls to the RPC, otherwise blender will hang until a connection is made (this also includes on startup).

Perhaps you've been having connection issues lately? Make sure you're properly able to connect to discord.com, and ensure that no firewalls are somehow blocking in/out traffic from the Discord client and Blender.

After ensuring your connection and if it still fails to load, what GPU(s) are you using? This may not sound relevant to the problem, although the script also grabs your GPU name as a display option on startup which would be the only other thing I would believe to cause a crash.

Thanks

inkoalawetrust commented 2 years ago

Installing the latest version seems to not cause Blender to freeze, also keep in mind that this just happened completely out of nowhere, and had never occurred before.

From the zip you provided, it appears you aren't using the latest version (you are using 1.7.1, the latest is 1.8.0). It's also important to note that an active internet connection is required in order for the add-on to properly make calls to the RPC, otherwise blender will hang until a connection is made (this also includes on startup).

Perhaps you've been having connection issues lately? Make sure you're properly able to connect to discord.com, and ensure that no firewalls are somehow blocking in/out traffic from the Discord client and Blender.

Nah, I was not having any connection issues when that begun, especially with Discord, since I was actively asking people on Discord if they have any idea what could be causing this sudden freezing.

That being said, the addon freezing the entire program if there is no internet connection sounds like a massive bug in itself. What if somebody is in a location without reliable internet, and their connection begins cutting off while they are working on a project ?

As for my GPU, it's a Gigabyte RTX 2060.

abrasic commented 2 years ago

"the addon freezing the entire program if there is no internet connection sounds like a massive bug in itself"

Yes, obviously that is not the desired effect, but its a limitation with regular code execution, it freezes the entire UI until code completion. Ive had attempts of preventing load when no internet is detected to no avail, but I plan on reading up how to either use asyncio or using a modal operator so these problems dont happen in the future, however free time hasnt been on my side lately.

Before enabling the addon, could you try toggling the console via Window > Toggle System Console and see if there are any errors that may appear when you try to enable it?

Thanks

Message ID: @.***>

inkoalawetrust commented 2 years ago

Nothing weird is being logged on the console when enabling the addon, even when I reinstall the old 1.7.1 version and re-enable it.

reloading addon: blendpresence 1664131923.744588 1664131928.8932683 'C:\\Users\\inkoalawetrust\\AppData\\Roaming\\Blender Foundation\\Blender\\3.3\\scripts\\addons\\blendpresence\\__init__.py'
Modules Installed () from 'C:\\Users\\inkoalawetrust\\Documents\\Blender Plugins\\blendpresence1.7.1.zip' into 'C:\\Users\\inkoalawetrust\\AppData\\Roaming\\Blender Foundation\\Blender\\3.3\\scripts\\addons'
module changed on disk: 'C:\\Users\\inkoalawetrust\\AppData\\Roaming\\Blender Foundation\\Blender\\3.3\\scripts\\addons\\blendpresence\\__init__.py' reloading...
[BP] Connected!
Davilarek commented 1 year ago

just experienced same issue. I launched blender with debug mode, and seen nothing weird. I got angry and just smashed ctrl-c to exit. But then a traceback said something about this addon. Full traceback here:

Traceback (most recent call last):
  File "C:\Users\davil\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blendpresence\__init__.py", line 67, in updatePresenceTimer
    updatePresence()
  File "C:\Users\davil\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blendpresence\__init__.py", line 357, in updatePresence
    rpcClient.update(
  File "C:\Users\davil\AppData\Roaming\Blender Foundation\Blender\3.3\scripts\addons\blendpresence\pypresence\presence.py", line 34, in update
    return self.loop.run_until_complete(self.read_output())
  File "F:\Program Files\Blender\3.3\python\lib\asyncio\base_events.py", line 628, in run_until_complete
    self.run_forever()
  File "F:\Program Files\Blender\3.3\python\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "F:\Program Files\Blender\3.3\python\lib\asyncio\base_events.py", line 595, in run_forever
    self._run_once()
  File "F:\Program Files\Blender\3.3\python\lib\asyncio\base_events.py", line 1845, in _run_once
    event_list = self._selector.select(timeout)
  File "F:\Program Files\Blender\3.3\python\lib\asyncio\windows_events.py", line 439, in select
    self._poll(timeout)
  File "F:\Program Files\Blender\3.3\python\lib\asyncio\windows_events.py", line 788, in _poll
    status = _overlapped.GetQueuedCompletionStatus(self._iocp, ms)
KeyboardInterrupt

It seems to get stuck on function updatePresenceTimer.

EDIT: Some info:

abrasic commented 1 year ago

I have been able to replicate a freezing issue on latest software some while ago, however this was a time where Discord services were slow, thus causing the presence to freeze the client until the Discord RPC responded.

While most freezes end up to be an issue on pypresence's end, Most of the freezing problems will most likely be fixed if (a) I get the time to make the functions asynchronous and (b) I write better error handling; both of which are planned for the next release.

ScrubN commented 1 year ago

As of recent, this plugin seems to inconsistently cause Blender to completely lock up during plugin init.

I tested Blender versions 3.2-3.6.1 using plugin version 1.7.1, all of which exhibit the lock up. By launching Blender via a terminal, I was able to abort loading the plugin with ctrl + c showing the culprit is the RPC connector. image

While most freezes end up to be an issue on pypresence's end

Based on the stacktrace it seems this is the case for me. For some stupid reason pypresence does not have a maximum iteration count when trying to connect to discord. image image