[
https://issues.redhat.com/browse/WFLY-13933?page=com.atlassian.jira.plugi...
]
Bartosz Baranowski commented on WFLY-13933:
-------------------------------------------
It looks like few undertow related classes violate contracts.
[
https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io...]
Implements Closeable. It has single method, which has following contract:
??Closes this stream and releases any system resources associated with it. If the stream
is already closed then invoking this method has no effect.??
??As noted
in [{{AutoCloseable.close()}}|https://docs.oracle.com/javase/8/docs/api/j...,
cases where the close may fail require careful attention. It is strongly advised to
relinquish the underlying resources and to internally _mark_ the {{Closeable}} as closed,
prior to throwing the {{IOException}}.??
As is, close method in DefaultAccessLogReceiver just flip a boolean flag. Actually
resource freeing actions are performed in another thread( XnioWorker).
Second violation is
in [https://github.com/wildfly/wildfly/blob/master/undertow/src/main/java...
In
Service([https://github.com/jboss-msc/jboss-msc/blob/1.4/src/main/java/or...
on stop there:
??Stop the service. Do not return until the service has been fully stopped, unless an
asynchronous service stop is performed.??
In both cases current behavior violate contract. In case of DefaultAccessLogReceiver -
stream is still open after close() method returns. IT is possible for stream to remain
open, if thread, in which it is supposed to be closed is terminated prior full write or
even execution due to changes in -WFCORE-1632.-
As to AccessLogService - all underlying resources are not stopped when method returns from
stop(). As is, IoUtils.safeClose((DefaultAccessLogReceiver) logReceiver); only flips flag
in log receiver. Not only that, it does it only if DefaultLogReceiver is being used(not
sure if its possible to configure something else, but it might be, judging from this
check).
access-log entries might become lost during the shutdown even if
graceful timeout is specified
------------------------------------------------------------------------------------------------
Key: WFLY-13933
URL:
https://issues.redhat.com/browse/WFLY-13933
Project: WildFly
Issue Type: Bug
Components: Web (Undertow)
Affects Versions: 20.0.0.Final
Reporter: Masafumi Miura
Assignee: Bartosz Baranowski
Priority: Major
access-log has a possibility to be lost during WildFly shutdown even if a graceful
timeout is specified.
If I understand correctly, access-log processing runs on a different thread from the
application processing and the graceful shutdown does not care about it.
Since WildFly 16+, WFCORE-1632 changed the shutdown behavior to wait only for 100ms
(hard-coded). So, WildFly 16+ does not wait for completing a task worker thread processing
access-log.
I understand the purpose of WFCORE-1632. However, it might be good if we have an option
to tune the wait time. (Of course, it would be difficult to know how long wait time is
sufficient for completion. And specifying a large wait time can be a cause of long
shutdown time. So, it's still questionable how it's useful.)
Or, if it's possible to implement that the graceful shutdown can wait for access-log
processing, it would be better. (This might be RFE?).
--
This message was sent by Atlassian Jira
(v7.13.8#713008)