|
1
|
================================================================================================
|
|
2
|
PROPOSAL - [MINOR] functional - ConfigItem.MAX_IDLE_TIME
|
|
3
|
The added javadoc sentence describes a page export that no shipped profile performs
|
|
4
|
================================================================================================
|
|
5
|
|
|
6
|
REVIEW FINDING (abridged)
|
|
7
|
"The added sentence 'Also exported to the page, where it sizes the browser's own silence
|
|
8
|
tolerance' does not describe any shipped configuration [...] WebClientBuilderOptions.readConfigs
|
|
9
|
unconditionally emits webSocketTimeout (default 90000; the debug profile sets 1200000) [...] so
|
|
10
|
the maxIdleTime branch is dead in both shipped profiles."
|
|
11
|
|
|
12
|
FILES
|
|
13
|
src/com/goldencode/p2j/util/ConfigItem.java
|
|
14
|
|
|
15
|
------------------------------------------------------------------------------------------------
|
|
16
|
1. ROOT CAUSE
|
|
17
|
------------------------------------------------------------------------------------------------
|
|
18
|
|
|
19
|
Current text, ConfigItem.java:361-367:
|
|
20
|
|
|
21
|
/**
|
|
22
|
* The idle time after which the connection should be closed, if webSocketTimeout is not set. Also
|
|
23
|
* exported to the page, where it sizes the browser's own silence tolerance.
|
|
24
|
*/
|
|
25
|
public static final ConfigItem<Integer> MAX_IDLE_TIME = ...
|
|
26
|
|
|
27
|
The caveat "if webSocketTimeout is not set" governs only the first sentence. The second sentence
|
|
28
|
adds a second role with no caveat - and it is the role an administrator would actually tune, since
|
|
29
|
it is what decides how long the browser tolerates silence before tearing the socket down.
|
|
30
|
|
|
31
|
Both roles are in fact subordinate to webSocketTimeout:
|
|
32
|
|
|
33
|
- WebPageHandler's MAX_IDLE_TIME key reads WEB_SOCKET_TIMEOUT first and returns it verbatim when
|
|
34
|
positive, falling back to MAX_IDLE_TIME only in the else. The new PING_PONG_INTERVAL key has
|
|
35
|
the same precedence.
|
|
36
|
- WebClientBuilderOptions.readConfigs does add(options, WEB_SOCKET_TIMEOUT,
|
|
37
|
MAX_WEB_SOCKET_IDLE_TIMEOUT) unconditionally (default 90000), and WebClientSpawner appends it
|
|
38
|
to the spawned client's command line with no null check. The debug profile in
|
|
39
|
WebClientBuilderParameters sets it to 1200000.
|
|
40
|
|
|
41
|
So the fallback branch is unreachable in both shipped profiles.
|
|
42
|
|
|
43
|
The wording is also imprecise in a second way: the code branches on webSocketTimeout > 0, not on the
|
|
44
|
key being absent. "Not set" suggests omitting it from directory.xml is enough, when in fact an
|
|
45
|
explicit non-positive value is required to reach the maxIdleTime branch at all.
|
|
46
|
|
|
47
|
Concrete trigger: set client:web:maxIdleTime=300000 and leave socketTimeout alone. index.html
|
|
48
|
renders ${maxIdleTime}=90000, and the browser's silence tolerance ignores the configured value with
|
|
49
|
nothing in the log to say why.
|
|
50
|
|
|
51
|
In fairness, maxIdleTime is not inert - WebSocketConfig feeds it to GenericWebServer as the
|
|
52
|
websocket handler's default idle timeout. But WebClientProtocol.onConnect then overrides that per
|
|
53
|
session from webSocketTimeout, so the override applies consistently to both the container timeout
|
|
54
|
and the page export. That is precisely why the caveat belongs on both sentences.
|
|
55
|
|
|
56
|
------------------------------------------------------------------------------------------------
|
|
57
|
2. PROPOSED FIX
|
|
58
|
------------------------------------------------------------------------------------------------
|
|
59
|
|
|
60
|
Make one caveat govern both roles and name the actual condition:
|
|
61
|
|
|
62
|
/**
|
|
63
|
* The idle time after which the connection should be closed, and the silence tolerance exported
|
|
64
|
* to the page. In both roles this applies only while {@code client:web:webSocketTimeout} is not
|
|
65
|
* positive; otherwise that setting supersedes it, and a spawned web client always receives an
|
|
66
|
* explicit value for it.
|
|
67
|
*/
|
|
68
|
public static final ConfigItem<Integer> MAX_IDLE_TIME =
|
|
69
|
new ConfigItem<>(Integer.class, "maxIdleTime", "client", "web", "maxIdleTime", Type.WEB_CLIENT);
|
|
70
|
|
|
71
|
The final clause is the part that saves an administrator's afternoon: it says outright that in
|
|
72
|
practice this value is not the one in force.
|
|
73
|
|
|
74
|
Note the deliberate choice of the client:web: notation, matching WATCHDOG_TIMEOUT's neighbouring doc
|
|
75
|
and the corrected notation used elsewhere in this revision.
|
|
76
|
|
|
77
|
The file's history entry 020 ("Corrected the heartbeat related config docs") already covers this
|
|
78
|
work; no new entry is needed if it lands in the same commit.
|
|
79
|
|
|
80
|
2.1 Optional companion, not proposed here
|
|
81
|
-------------------------------------------
|
|
82
|
|
|
83
|
The underlying usability problem is that two keys silently shadow each other with no diagnostic.
|
|
84
|
A one-line INFO in WebClientProtocol.onConnect or WebPageHandler, emitted when both are configured
|
|
85
|
and webSocketTimeout wins, would make the shadowing visible at runtime rather than only in javadoc.
|
|
86
|
That is a behaviour change and belongs in its own task; it is recorded here because the same
|
|
87
|
shadowing was the substance of a second, rejected review finding about PING_PONG_INTERVAL, which
|
|
88
|
suggests the pattern rather than the individual doc is what deserves attention.
|
|
89
|
|
|
90
|
------------------------------------------------------------------------------------------------
|
|
91
|
3. RELATIONSHIP TO OTHER PROPOSALS
|
|
92
|
------------------------------------------------------------------------------------------------
|
|
93
|
|
|
94
|
None. Self-contained comment change.
|
|
95
|
|
|
96
|
Related but not proposed: the review's PING_PONG_INTERVAL javadoc finding was rejected on the
|
|
97
|
grounds that no other ConfigItem in the file documents clamping. If 2.1 is ever taken, that decision
|
|
98
|
is worth revisiting for both keys together.
|
|
99
|
|
|
100
|
------------------------------------------------------------------------------------------------
|
|
101
|
4. RISK AND VERIFICATION
|
|
102
|
------------------------------------------------------------------------------------------------
|
|
103
|
|
|
104
|
Risk: none. Comment-only.
|
|
105
|
|
|
106
|
Verification
|
|
107
|
1. ./gradlew compile and ./gradlew javadoc produce no new warnings.
|
|
108
|
2. Confirm the claim empirically before committing the wording: set client:web:maxIdleTime to a
|
|
109
|
distinctive value (300000), leave socketTimeout unset, start a web client, and check the
|
|
110
|
rendered index.html - ${maxIdleTime} should be 90000, not 300000.
|
|
111
|
3. Repeat with client:web:socketTimeout explicitly set to 0 and confirm the maxIdleTime value
|
|
112
|
does then reach the page, i.e. the branch is reachable exactly as the new wording says.
|