-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
fix: on exception, return a 0, so that the "sum" still computes #1204
fix: on exception, return a 0, so that the "sum" still computes #1204
Conversation
This fixes a bug where after a while in a Jupyter notebook, we start to see many log lines like this: ``` [IPKernelApp] ERROR | Exception in control handler: Traceback (most recent call last): File ".../lib/python3.8/site-packages/ipykernel/kernelbase.py", line 336, in process_control await result File ".../lib/python3.8/site-packages/ipykernel/kernelbase.py", line 998, in usage_request reply_content["kernel_memory"] = sum( TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' ``` Since the "sum" expects a number (float or int) as elements given to the "sum", we should pass "0" (zero) and not None when we that process id does not exist anymore. This was tested in an actually running notebook and it fixed the problem: * no morre Exceptions like the one reported above * correct memory stats where seen with the Kernel Usage plug-ins
This is a bug fix and needs the "bugfix" Label. As an external contributor, I am unable to set it. Also, I am pinging @echarles since we discussed this out-of-band and Eric is marked in git as the previous contributor that touched this code. Many thanks for your attention (I hacked it locally here in the site-packages and it seems to work for me :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thx @petervandenabeele
@blink1073 📝 test_lint → ❌ failure [required to succeed] is failing, not sure about that one. |
There seems to be a problem with a linting ignore that is not correctly set-up ? https://github.com/ipython/ipykernel/actions/runs/7785980351/job/21229753213?pr=1204#step:4:75
|
FYI: the same "linting" problem also occurs in another PR I just made today (5 Feb 2024) and that only added 1 line to .gitignore: |
The lint failures comes from a version update in the linter, I'll address in a separate PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
This fixes a bug where after a while in a Jupyter notebook, we start to see many log lines like this:
Since the "sum" expects a number (float or int) as elements given to the "sum", we should pass "0" (zero) and not None when that process id does not exist anymore.
This was tested in an actually running notebook and it fixed the problem: