Using IO or rescuing exceptions when setting a timeout
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ệ
- Công nghệ
- javascript, ruby
Hướng nghiên cứu
Start by reading stop_attached and def timeout(&blk) in MiniRacer, the two entry points named in the report. Reproduce the attached callback with a timeout, IO, and a rescued exception, then compare the reported termination errors; done means identifying why timeout handling changes the callback outcome and documenting or fixing the behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hello everyone :)
I've ran into a curious issue when setting a timeout at context creation. The underlying timeout detection doesn't seem to allow for rescue exceptions in attached methods, nor using IO.
Here is an example :
def download_base64(url)
data = URI.open(url)
data = Base64.encode64(data&.read || "")
{ data: data }
rescue => e
{ error: e.to_s }
end
js_context = MiniRacer::Context.new(timeout: 10)
js_context.attach('download64', proc { |url|
download_base64(url)
})
begin
result = js_context.call('download64', 'https://google.com/favicon.ico')
puts "RESULT: #{result}"
rescue => e
puts "ERROR: #{e}"
end
The code above ends up outputting:
ERROR: JavaScript was terminated (either by timeout or explicitly)
If I remove the rescue from the download_base64 ruby method, the output turns into :
ERROR: Terminated during callback
I have traced the error above to stop_attached inside MiniRacer.
If I remove the timeout, the result is a base64 encoded string of the Google's favicon.
I have disabled the timeout for now but would be very interesting to understand what goes on behind the scene. I have tried to go into the def timeout(&blk) method, and I am not sure why the current code there doesn't work, it doesn't seem to do anything you wouldn't expect it do it.
- Ngôn ngữ chính
- JavaScript
- Star
- 628
- Fork
- 100
- Merge trung bình
- 1 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không 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 rubyjs/mini_racer
-
bug/crash platform: linux/x86
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
rubyjs/mini_racer#422 · 10 bình luận ·
-
platform: darwin/x86
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
rubyjs/mini_racer#388 · 4 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
rubyjs/mini_racer#376 ·
-
Load script as moduleĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
rubyjs/mini_racer#353 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
rubyjs/mini_racer#346 · 6 bình luận · 1 reaction ·
Tất cả issue của rubyjs/mini_racer
Issue tương tự
-
bug Frontend P2-medium UI UX
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
Deepak3699/Ai_Mentor#427 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
11ty/buildawesome#4407 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
keyxmakerx/Chronicle#1711 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
frontend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
uoftblueprint/canada-basketball#79 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
New App Request
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
ThatGuySam/doesitarm#1126 · 1 bình luận ·