major
#29383
Dead SOCKET_APPENDER (Chainsaw, localhost:4445) in default logging config can stall logging and abort operations under load
The default logging configuration (tl-core, WEB-INF/conf/logging/default.xml) defines a log4j2 Socket appender SOCKET_APPENDER targeting localhost:4445 (intended for a Chainsaw dev receiver). It is gated by the tl_developerMode=true SystemPropertyArbiter and referenced from <Root>, so in developer mode every logged event is routed to it.
When no receiver listens on 4445 (the usual case in developer mode), log4j's TcpSocketManager keeps a background Reconnector and buffers writes to the dead endpoint. Under a burst of log messages the socket's send buffer fills. Because the framework runs under log4j's AwaitCompletionReliabilityStrategy, the logging call then blocks and/or throws AppenderLoggingException from inside Logger.info(...). Two consequences:
- The whole logging pipeline stalls — the FILE_APPENDER stops receiving events, so top-logic.main.log freezes while the application keeps running.
- The failure propagates into the calling application code that issued the log call.
Observed impact: a long-running background operation that narrated progress via the TL-Script log(...) function (~3200 messages within a few seconds) had its logging pipeline break; the main log froze mid-run and the operation aborted silently at a clean batch boundary. Abbreviated stack:
org.apache.logging.log4j.core.appender.AppenderLoggingException: Error writing to TCP:localhost:4445: socket not available
at org.apache.logging.log4j.core.net.TcpSocketManager.write(TcpSocketManager.java:264)
at org.apache.logging.log4j.core.appender.SocketAppender.directEncodeEvent(SocketAppender.java:598)
at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(...)
at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:92)
at org.apache.logging.log4j.core.Logger.log(Logger.java:187)
at com.top_logic.basic.Logger.info(Logger.java:174)
A dead/optional dev appender must never be able to stall the file/console logging or break the application. Requested fix (any of):
- Remove SOCKET_APPENDER from the default configuration; or
- Make it robust: set ignoreExceptions="true", wrap it in an Async appender, and/or only enable it when a receiver on 4445 is actually reachable.
Workaround in an application: override WEB-INF/conf/logging/default.xml and drop the SOCKET_APPENDER appender definition and its <Root> AppenderRef.
Migration
Developers who forward log events to an external log viewer (e.g. Chainsaw listening on localhost:4445) must now enable the SOCKET_APPENDER explicitly: add
-Dtl_logReceiver=true
to the VM arguments of the launch configuration. Developer mode (tl_developerMode=true) alone no longer activates the appender. Host, port, and the serialized event format are unchanged. Developers who do not run a log receiver need to change nothing — the appender is no longer part of their logging configuration.
Note for opted-in users: the appender runs with ignoreExceptions="true"; while no receiver is reachable, events destined for the socket are dropped silently — file and console logging are unaffected.