IronLanguages / IronLanguages/ironpython3
Incorrect argument in function select() causes stack overflow
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 316
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 1
Description
This piece of code leads to a stack overflow. The execution of the program stops at stacktrace. See the following reporting information. I think the problem may be related to recursion, the code basically ends up with an unlimited number of iterations of select.select and test_select_mutated on the call stack and this doesn't trigger the stack depth checker.
test.py
import select
def test_select_mutated():
a = []
class F:
def fileno(a):
del test_select_mutated()[-1]
return sys.__stdout__.fileno()
a[:] = [F()] * 10
select.select([], a, []), ([], a[:5], [])
test_select_mutated()
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
Stack overflow in unmanaged: IP: 0x718dd9, fault addr: 0x7ffcd96beff8
Stack overflow: IP: 0x7f734c953bce, fault addr: 0x7ffcd96b6fc8
Stacktrace:
at <unknown> <0xffffffff>
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 reproduction in test.py and run it in the stated IronPython and Mono environment. Trace the select.select call into the implementation while observing the repeated test_select_mutated and select.select frames. Done means the reproduction no longer causes a stack overflow and has a regression test for the mutated file-descriptor case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100