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

Abierto
#1,997 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
58/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Java
Estrellas
214
Forks
46
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de lsfusion/platform

Todos los issues de lsfusion/platform

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.