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

Nicotine crashes upon quitting #1525

Closed
sonn-gamm opened this issue Sep 3, 2021 · 11 comments
Closed

Nicotine crashes upon quitting #1525

sonn-gamm opened this issue Sep 3, 2021 · 11 comments
Labels

Comments

@sonn-gamm
Copy link

Nicotine+ version: 3.1.0
Operating System/Distribution: macOS 11.5.2

Describe the bug

when quitting the program (with cmd + q) i received an error message (suggesting me to report the bug).

Expected behavior

the program quits as it should.

Steps to reproduce the bug

  • open Nicotine+ 3.1.0
  • do some searches
  • quite the program with cmd + q

Additional context

Type: <class 'ValueError'>
Value: Invalid file descriptor: -1
Traceback:   File "/usr/local/opt/pygobject3/lib/python3.9/site-packages/gi/_ossighelper.py", line 92, in signal_notify
    def signal_notify(source, condition):
  File "/usr/local/Cellar/nicotine-plus/3.1.0/libexec/lib/python3.9/site-packages/pynicotine/gtkgui/frame.py", line 2553, in on_quit
    self.save_state()
  File "/usr/local/Cellar/nicotine-plus/3.1.0/libexec/lib/python3.9/site-packages/pynicotine/gtkgui/frame.py", line 2559, in save_state
    self.np.quit()
  File "/usr/local/Cellar/nicotine-plus/3.1.0/libexec/lib/python3.9/site-packages/pynicotine/pynicotine.py", line 320, in quit
    self.protothread.abort()
  File "/usr/local/Cellar/nicotine-plus/3.1.0/libexec/lib/python3.9/site-packages/pynicotine/slskproto.py", line 556, in abort
    self.server_disconnect()
  File "/usr/local/Cellar/nicotine-plus/3.1.0/libexec/lib/python3.9/site-packages/pynicotine/slskproto.py", line 546, in server_disconnect
    self.close_connection(self._connsinprogress, i)
  File "/usr/local/Cellar/nicotine-plus/3.1.0/libexec/lib/python3.9/site-packages/pynicotine/slskproto.py", line 717, in close_connection
    self.selector.unregister(connection)
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 534, in unregister
    key = super().unregister(fileobj)
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 250, in unregister
    key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 226, in _fileobj_lookup
    return _fileobj_to_fd(fileobj)
  File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 42, in _fileobj_to_fd
    raise ValueError("Invalid file descriptor: {}".format(fd))
@sonn-gamm sonn-gamm added the bug label Sep 3, 2021
@slook
Copy link
Member

slook commented Sep 3, 2021

Thank you for taking the time to report this @afincato

I am personally not qualified to know what the exact cause of this issue is, or if it would be fixed in the most recent revision of Nicotine 3.1.1 or not, but if there is no particular reason why you still need to use the previous revision, then it might be worth a go. Link:

Download Installer (Catalina/10.15 and newer)

Please note I can't see anything that jumps out at me in the changelog that specifically addresses the problem you reported, but I could be wrong about that, I've not tried any MacOS version myself.

i received an error message (suggesting me to report the bug).
Type: <class 'ValueError'> Value: Invalid file descriptor: -1

I am unclear if you say this bug is reproducible or not... Please can you clarify if the issue occurred only once, or is it every time you press Cmd+Q, or just some of the time?

Should the error be encountered again in the future with the current revision, then other MacOS users would be interested to have it fixed for future versions, so please do post again on here if you encounter the error message again.

@francisuk1989
Copy link

francisuk1989 commented Sep 4, 2021

@afincato Also what Mac?
Reason im asking im wondering if the one with a Apple M1/ARM chipset and suffer the same as this issue also? #1475

I can see you used brew for nicotine plus try brew upgrade in your terminal, Once upgraded try nicotine plus again and see if is the same behavior

@sonn-gamm
Copy link
Author

sonn-gamm commented Sep 4, 2021

Thanks both!

I upgraded Nicotine with brew to the latest version. Tried a few downloads and that works. I noticed though that the UI is quite slow (eg the cursor), but things work (this reminded me why I switched back to Soulseek QT, UI responsiveness).

Reason im asking im wondering if the one with a Apple M1/ARM chipset and suffer the same as this issue also? #1475

I use a MacBook Pro 15 from 2015, and upgraded to Big Sur a few months ago.

I am unclear if you say this bug is reproducible or not... Please can you clarify if the issue occurred only once, or is it every time you press Cmd+Q, or just some of the time?

now Cmd+Q works as expected, no issue. I wonder what could have been. To give more context, yesterday before opening Nicotine+ I was trying to download a few things with Soulseek QT and it crashed on me twice after an item would be added to the download queue. Not sure if somehow my computer had to clear up some network congestion from Soulseek before being operative again.

I think we can close. Appreciated the fast response!

@slook
Copy link
Member

slook commented Sep 4, 2021

You're welcome :-)

It shouldn't be the case that the UI is unresponsive. This is not normal behaviour, so it requires further investigation incase other similar systems are affected (Edit: it does indeed seem that M1 Macs are affected by this issue too).

As the first troubleshooting step, please can you deselect Menu > View > Use Header Bar @afincato

When you have done this and tested it for a while, please respond to let us know if this has made any difference or not.

@francisuk1989
Copy link

francisuk1989 commented Sep 4, 2021

Welcome @afincato is also been reported that is a GTK 3 behaviour on MacOS, see #1475 (comment)

@mathiascode has mention GTK 4 seems to be an improvement for MacOS

If you wiling to build and compatible a GTK 4 with brew however before doing so, wait for @mathiascode to confirm if you need to remove the GTK 3 from brew before adding GTK 4

brew remove gtk+
brew remove gtk+3
brew update
brew upgrade
brew cleanup
git clone https://github.com/nicotine-plus/nicotine-plus
cd nicotine-plus
NICOTINE_GTK_VERSION=4 nicotine
python3 packaging/macos/dependencies_core.py
python3 packaging/macos/dependencies_packaging.py
pyinstaller packaging/macos/nicotine.spec
rm -rf dist/Nicotine+/
codesign --deep --entitlements packaging/macos/entitlements.plist --options runtime --sign - dist/Nicotine+.app
python3 packaging/macos/create_dmg.py

@sonn-gamm
Copy link
Author

i tried to build Nicotine+ with GTK4 and it seems to run fine! when doing searches the input text does not lag, changing tab and moving the cursor goes smooth.

i noticed that with brew i would need to run the app on the terminal, a python application icon would open the GUI window and the app backend server would run in the terminal... ops.

then for completeness i tried to install the latest dmg of Nicotine+ (instead of installing it with brew) (eg running GTK3).

(i closed Nicotine+ GTK4 and copied the Nicotine+ GT3 on the desktop instead of dragging it to the Applications folder)

i did Menu > View > Use Header Bar and did some searches: the text input would still lag a bit, but the cursor and tab change would act smoothly.

upon Cmd + Q i got this other error:

Type: <class 'ValueError'>
Value: Invalid file descriptor: -1
Traceback:   File "pynicotine/gtkgui/frame.py", line 2550, in on_quit
  File "pynicotine/gtkgui/frame.py", line 2556, in save_state
  File "pynicotine/pynicotine.py", line 320, in quit
  File "pynicotine/slskproto.py", line 551, in abort
  File "pynicotine/slskproto.py", line 541, in server_disconnect
  File "pynicotine/slskproto.py", line 669, in close_connection
  File "selectors.py", line 534, in unregister
  File "selectors.py", line 250, in unregister
  File "selectors.py", line 226, in _fileobj_lookup
  File "selectors.py", line 42, in _fileobj_to_fd

i am more than happy to run the hand-compiled GTK4 version of the UI as it seems to work perfectly! (:

if i made some mistake along the way please tell me, but it seems that GTK4 is performing much better.

@francisuk1989
Copy link

francisuk1989 commented Sep 5, 2021

upon Cmd + Q i got this other error:

Type: <class 'ValueError'>
Value: Invalid file descriptor: -1
Traceback:   File "pynicotine/gtkgui/frame.py", line 2550, in on_quit
  File "pynicotine/gtkgui/frame.py", line 2556, in save_state
  File "pynicotine/pynicotine.py", line 320, in quit
  File "pynicotine/slskproto.py", line 551, in abort
  File "pynicotine/slskproto.py", line 541, in server_disconnect
  File "pynicotine/slskproto.py", line 669, in close_connection
  File "selectors.py", line 534, in unregister
  File "selectors.py", line 250, in unregister
  File "selectors.py", line 226, in _fileobj_lookup
  File "selectors.py", line 42, in _fileobj_to_fd

@mathiascode sounds like to me this be a timeout error on both GUI and Network however i cant confirm if is Big SIr 11.5.2 thats the issue for GTK4 as i have a Rust-lang issue but that would be down to a older Mac Pro on El Capitan 10.11.6

i noticed that with brew i would need to run the app on the terminal, a python application icon would open the GUI window and the app backend server would run in the terminal... ops.

@afincato You need to create DMG file for GTK4 and replace app into Applications, Might be an idea to rename the app when is created nicotine grk4 so you can have one that gtk3 and gtk4 and so on.

@afincato
Yes i have the same behaver in GTK3 where it lag if i move the App around the screen but once is wide enough for the screen is fine without lag (for me on MacOS 10.11.6 though) but now been disabled 0821179

i am more than happy to run the hand-compiled GTK4 version of the UI as it seems to work perfectly! (:

If you going to do this, i would recommend either to do some sort of cronjob to delete the nicotine-plus folder and re-download using some sort of git clone method as the acual settings are stored in /Users/MrSJobs/.local/share/nicotine and with brew update and brew upgrade to keep update with GTK4.

@slook
Copy link
Member

slook commented Sep 11, 2021

@afincato As a result of your bug report, a fix has been implemented which avoids this crash on similar MacOS systems. Thank you for posting the error logs which helped to identify the issue.

You can run from git/brew or download and install the latest Unstable version of Nicotine+ for MacOS which also includes further optimizations for GTK4 support that you may be interested in testing out, this is still a work in progress for Nicotine+ 3.2.0 so please feel free to post on here should you encounter any further issues. Thank you for your time and feedback.

@sonn-gamm
Copy link
Author

Thanks for your work!

I just had some time to try the new version out (using the pre-compiled, unstable version for macOS) and upon launching Nicotine I got this error:

Nicotine+ Version: 3.2.0.dev1
GTK Version: 
Python Version: 3.9.7 (default, Sep  3 2021, 12:45:31) 
[Clang 12.0.0 (clang-1200.0.32.29)]

Type: <class 'KeyError'>
Value: 'protocols'
Traceback:   File "pynicotine/gtkgui/frame.py", line 2517, in on_critical_error_response
  File "pynicotine/gtkgui/frame.py", line 971, in on_report_bug
  File "pynicotine/utils.py", line 153, in open_uri

Manually pulling down from git and running the pip installation command, then running nicotine from the terminal correctly runs Nicotine+, and the UI is quite responsive!

Could it be something with the DMG packaging going wrong?

@slook
Copy link
Member

slook commented Sep 26, 2021

Why is there no GTK version reported? That's strange, but unrelated as the failure occurred in an area with an URL handler.

There has been a commit added 0976348 please can you test the Unstable installer again if you can, and verify if this fixes the issue or not?

@sonn-gamm
Copy link
Author

Latest Unstable installer works perfectly. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants