GraalPy silent error on multi-threaded code
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- compilers, operating-systems
Hướng nghiên cứu
Bắt đầu bằng cách chạy test.py được cung cấp và trình điều khiển subprocess với bản phát hành Windows AMD64 của GraalPy 24.2.2 hoặc 25.0, sau đó so sánh các lỗi với đầu ra đã thu thập và stack trace của PolyglotLanguageContext.dispose. Điều tra đường dẫn tắt nhiều luồng; được xem là hoàn tất khi workload hoàn thành mà không bị crash im lặng và mọi lỗi đều được báo cáo kèm đầu ra hữu ích.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi,
We're a research group that works on testing concurrent language implementations. When applying our recent prototype to GraalPy, we noticed that it would abrutply crash without any output or error.
This is a rare bug (observed 1 or 2 times over 100 executions) that affects the Windows AMD64 release for versions 25.0 and 24.2.2. We have not been able to reproduce this bug on Linux AMD64 at all. We're checking ARM, I'll update below if we find anything.
One time I was able to observe the following stack trace on 24.2.2:
ERROR: java.lang.IllegalStateException: The language did not complete all polyglot threads but should have: [Thread[#50051,Polyglot-python-49999,5,GRAALPYTHON_THREADS]]
org.graalvm.polyglot.PolyglotException: java.lang.IllegalStateException: The language did not complete all polyglot threads but should have: [Thread[#50051,Polyglot-python-49999,5,GRAALPYTHON_THREADS]]
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.dispose(PolyglotLanguageContext.java:463)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.disposeContext(PolyglotContextImpl.java:3404)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.finishClose(PolyglotContextImpl.java:2979)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.closeImpl(PolyglotContextImpl.java:2883)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.closeAndMaybeWait(PolyglotContextImpl.java:2035)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.close(PolyglotContextImpl.java:1968)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextDispatch.close(PolyglotContextDispatch.java:72)
at org.graalvm.polyglot/org.graalvm.polyglot.Context.close(Context.java:881)
at org.graalvm.polyglot/org.graalvm.polyglot.Context.close(Context.java:908)
at com.oracle.graal.python.shell.GraalPythonMain.launch(GraalPythonMain.java:854)
at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:312)
at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:126)
at org.graalvm.launcher.AbstractLanguageLauncher.runLauncher(AbstractLanguageLauncher.java:180)
Suppressed: Attached Guest Language Frames (0)
Internal GraalVM error, please report at https://github.com/oracle/graal/issues/.
Here is the program we're using to find this bug (test.py):
import threading
import sys
from collections import *
def t0(b1,s,res):
b1.wait()
try:
res.append(s.insert(0, 10))
except Exception as error:
res.append(repr(error))
def t1(b1,s,res):
b1.wait()
try:
res.append(s.clear())
except Exception as error:
res.append(repr(error))
def t2(b1,s,res):
b1.wait()
try:
res.append(s.insert(0, 10))
except Exception as error:
res.append(repr(error))
def t3(b1,s,res):
b1.wait()
try:
res.append(s.__ne__([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]))
except Exception as error:
res.append(repr(error))
def Test():
normal_data_structure = [1, 2, 3]
possible_results = [([10], ['None', 'None', 'None', 'True']),
([], ['None', 'None', 'None', 'True']),
([10, 10], ['None', 'None', 'None', 'True'])]
threads=[]
barrier = threading.Barrier(4)
res = []
threads.append(threading.Thread(target= t0, args=(barrier, normal_data_structure,res)))
threads.append(threading.Thread(target= t1, args=(barrier, normal_data_structure,res)))
threads.append(threading.Thread(target= t2, args=(barrier, normal_data_structure,res)))
threads.append(threading.Thread(target= t3, args=(barrier, normal_data_structure,res)))
for i in range(0, len(threads)):
threads[i].start()
for i in range(0, len(threads)):
threads[i].join()
for i in range(0, len(res)):
if isinstance(res[i], set):
temp = list(map(str,list(res[i])))
temp.sort()
res[i]= str(temp)
else:
res[i]= str(res[i])
res.sort()
if (normal_data_structure, res) not in possible_results:
print("found bug: " + str((normal_data_structure,res)))
normal_data_structure = [1, 2, 3]
print("test begin...")
for i in range(0,100):
threads = []
print(i)
# if i % 1000 == 0:
# print(i)
for i in range(0,100):
threads.append(threading.Thread(target= Test))
for t in threads:
t.start()
for t in threads:
t.join()
print("test Done")
And we run it with the following driver:
import subprocess
import traceback
fail_count = 0
for i in range(100):
try:
r = subprocess.run(['graalpy-24.2.2-windows-amd64/bin/graalpy.exe',
'--log.python.level=FINE', '--log.engine.level=FINE', '--log.launcher.level=FINE',
'test.py'],
capture_output=True, # comment this line if you want to see the live counter from the subprocess
check=True,
text=True)
print(f"Done with {i}")
if r.stderr:
with open(f'good_output{i}.txt', 'w+') as f:
f.write(r.stderr)
except subprocess.CalledProcessError as e:
fail_count += 1
print(f"Failcount: {fail_count}")
print(f"Subprocess Error: [{e}]")
print("Return code:", e.returncode)
print('stderr written to error_output.txt')
if e.stderr:
with open(f'error_output{i}.txt', 'w+') as f:
f.write(e.stderr)
# dead code below
except Exception:
print("Something else went wrong")
traceback.print_exc()
print(f"Subprocess failed {fail_count} times")
@mqbal is part of the team, adding them so they get notified about further discussion.
- Ngôn ngữ chính
- Python
- Star
- 1.7k
- Fork
- 155
- Merge trung bình
- 6 giờ 28 phút
- Pull request đã merge (30 ngày)
- 49
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của oracle/graalpython
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
oracle/graalpython#1105 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
oracle/graalpython#1102 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 74/100
oracle/graalpython#1133 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
oracle/graalpython#1112 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
oracle/graalpython#1111 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của oracle/graalpython
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Juniper/ansible-junos-stdlib#904 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
pollen-robotics/reachy_mini#1457 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:runtime good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
WATonomous/wato_f1tenth#39 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
FireDynamics/fdsreader#123 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100