After a failed `/exec` or `/eval` request the thread that handled it keeps a stale lsFusion stack: every later error on that thread is reported without the executing action and its position, in the response and in the server log

Đang mở
#1,997 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
api, backend, observability

Hướng nghiên cứu

Start by tracing how request errors capture and clear the lsFusion execution stack for /eval and /exec, including failures during script compilation. Reproduce the stale stack by sending the provided failing script repeatedly, then check the HTTP response and logs/stderr.log. Done when each error reports only the stack and positions from its own request, including after earlier compile or runtime failures.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Description

When an action called through the HTTP API fails at run time, the error is reported with the lsFusion stack: the actions being executed, each with its module, line and column. Since #1881 the 500 response carries it too. This works only for the first failure a server thread handles. Every later failure handled by that thread is reported with one line left over from the earlier request instead of its own stack, so a few failed requests after a server start the stack is gone from all responses, and from logs/stderr.log as well, until the server is restarted.

The script below needs no application code and can be sent to /eval on any server:

fail() {
    throwException('boom');
}
run() {
    fail();
}

Sent 14 times in a row to a server that has just started (7.0-SNAPSHOT master, d4ac0948a8, development mode), it gets two different answers. Calls 1-5 (the Java stack trace that follows is left out):

Internal Server Error: lsfusion.server.logics.action.flow.LSFException boom
... - RMI execution(RemoteLogics.eval(..))
... - RMI execution(RemoteConnection.eval(..))
Execute action : at run [UNIQUE1NSNAME(7:5)]
Execute action : at fail [UNIQUE1NSNAME(4:5)]
Execute action : System.throwException[STRING] 'Throw exception' [System(135:17)]

Calls 6-14, and every call after them:

Internal Server Error: lsfusion.server.logics.action.flow.LSFException boom
... - RMI execution(RemoteLogics.eval(..))

The line that is left does not belong to the failed request: /exec?action=System.throwException&p=boom2 sent after them is answered with RMI execution(RemoteLogics.eval(..)) too, the entry point of an earlier /eval request. The same error in logs/stderr.log loses the Execute action lines in the same way.

A request that fails while its script is being compiled leaves the thread in the same state. After a server start, 14 scripts that refer to an unknown property (run() { EXPORT JSON FROM x = nosuchprop(); }) were sent first, and then the script above 8 times: none of the 8 answers had the Execute action lines.

Fix

Every error of a request is reported with the lsFusion stack of that request: the actions it was executing and their positions, however many requests failed before it on the same thread. Nothing of the stack of an earlier request appears in a later error.

Reason

The position of the failing statement is the only part of an internal error that tells an application developer, or an assistant calling /eval, where to look. #1881 put it into the response for exactly that purpose. An assistant usually sends a script with a compile error or two before the one that fails at run time, so on a development server the stack is missing in practice almost always, and several feedback reports about "a bare internal server error with no lsFusion element" describe exactly that. The same error with a stack on a restarted server and without one a few requests later reads as two different problems, and the server log, which used to be the fallback, loses the lines too.

Ngôn ngữ chính
Java
Star
214
Fork
46
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của lsfusion/platform

Tất cả issue của lsfusion/platform

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.