IronLanguages / IronLanguages/ironpython3
Infinite loop causes Null Reference Exception of ironpython
Open
Nobody has claimed this yet.
confirmed
Mono
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 316
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 1
Description
The following code leads to Null Reference Exception of iron python. In class WarnOnDel, function del is executed multiple times, leading to Null Reference Exception.
test.py
import threading
import warnings
class WarnOnDel(object):
def __del__(self):
warnings.warn("wrong", UserWarning)
def do_work():
while True:
w = WarnOnDel()
for i in range(10):
t = threading.Thread(target=do_work)
t.setDaemon(1)
t.start()
Environmental:
IronPython 3.4.0a1 (3.4.0.0001)
[.NETFramework,Version=v4.6 on Mono 6.12.0.122 (tarball Mon Feb 22 17:28:32 UTC 2021) (64-bit)] on linux
Error report:
(base) xxm@xxm-System-Product-Name:~$ ipy test.py
test.py:1: UserWarning: oh no something went wrong
import threading
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at IronPython.Runtime.WeakRefTracker.Finalize () [0x00000] in <5cd2739cd27844619789a1aa1ffdb0b0>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at IronPython.Runtime.WeakRefTracker.Finalize () [0x00000] in <5cd2739cd27844619789a1aa1ffdb0b0>:0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the test.py reproducer and the IronPython.Runtime.WeakRefTracker.Finalize stack-trace entry. Investigate why repeated threaded object finalization reaches a null reference, then verify that the reproducer completes without the exception and add regression coverage if the repository has a suitable test location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100