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

Aperta
#1,997 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Java
Stelle
214
Fork
46
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lsfusion/platform

Tutte le issue di lsfusion/platform

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.