project-lux / lux-marklogic

Code, issues, and resources related to LUX MarkLogic
Other
3 stars 2 forks source link

Improve conditional logic for returning a 408 status code (time out) #178

Open brent-hartwig opened 5 months ago

brent-hartwig commented 5 months ago

Problem Description:

162's performance test did not return a single 408 yet there was evidence of three semantic facet requests timing out. Those requests ended up getting a status code of 500 (internal error). Since that does not compel the data service proxies to retry the request, one may consider the priority low.

Expected Behavior/Solution: Below is a copy of the serialized exception for one of the timed out semantic facet requests. Given nothing therein indicates the request timed out, we may want luxErrorHandler.mjs to go by elapsed time. All instances in #162 and https://git.yale.edu/lux-its/marklogic/issues/1033 had an elapsed duration of 58 seconds or more. But since our timeouts vary by request type, we may also need to take exception details into account. For instance, facet requests are given 59 seconds and _getViaSearchFacets is unique to semantic facet requests, which is present below. If we go down that path, we need to determine which request types are in scope of this ticket.

2024-06-07 18:28:15.100 Notice: JS-BAD: .toArray() -- Unexpected failure: checkMaybeLocal wrapValue valObj
2024-06-07 18:28:15.100 Notice:+in [anonymous], at 44:5 [javascript]
2024-06-07 18:28:15.100 Notice:+in ./utils/utils.mjs, at 111:14, in evalInContentDatabase() [javascript]
2024-06-07 18:28:15.100 Notice:+in ./SearchCriteriaProcessor.mjs, at 188:17, in getSearchResults() [javascript]
2024-06-07 18:28:15.100 Notice:+in ./searchLib.mjs, at 178:38, in _search() [javascript]
2024-06-07 18:28:15.100 Notice:+in ./searchLib.mjs, at 81:9, in search() [javascript]
2024-06-07 18:28:15.100 Notice:+in ../../lib/facetsLib.mjs, at 313:17, in _getViaSearchFacetValues() [javascript]
2024-06-07 18:28:15.100 Notice:+in ../../lib/facetsLib.mjs, at 269:17, in _getViaSearchFacets() [javascript]
2024-06-07 18:28:15.100 Notice:+in ../../lib/facetsLib.mjs, at 52:37, in getFacets() [javascript]
2024-06-07 18:28:15.100 Notice:+in /ds/lux/facets.mjs, at 12:9 [javascript]
2024-06-07 18:28:15.100 Notice:+in ../../lib/requestHandleLib.mjs, at 10:9, in handleRequest() [javascript]
2024-06-07 18:28:15.100 Notice:+in /ds/lux/facets.mjs, at 11:0 [javascript]
2024-06-07 18:28:15.100 Notice:+in xdmp:eval("\nconst op = require(\"/MarkLogic/optic\");\nconst crm = op.pref...", {}, {database:"7947491399340755119", update:"false"}) [javascript]
2024-06-07 18:28:15.100 Notice:+in /ds/lux/facets.mjs [javascript]
2024-06-07 18:28:15.100 Notice:+in /ds/lux/facets.mjs [javascript]

Requirements: List of details required for the completion of the issue or requirements for the feature/bug. This can also include requirements that lie outside of the teams such as new design docs or clarification from an outside source.

Needed for promotion: If an item on the list is not needed, it should be crossed off but not removed.

~- [ ] Wireframe/Mockup - Mike~

UAT/LUX Examples: Developer will need to come up with a request / scenario that exceeds the applicable threshold.

Dependencies/Blocks: If the conclusion of https://github.com/project-lux/lux-marklogic/issues/89 is to not keep the custom error handler, we need not implement this ticket.

Related Github Issues: None.

Related links: None.

Wireframe/Mockup: Not needed.

brent-hartwig commented 5 months ago

FYI @roamye

roamye commented 4 months ago

@brent-hartwig - would @clarkepeterf be best to answer the question of: Which request types are in scope (see above)?

or is this a question that should be answered within the IT team meeting agenda?

brent-hartwig commented 4 months ago

@roamye, my preference would be to give discretion to the developer. If quick enough to implement against an elapsed time that is adjusted for the request type, let's do the facets, related list, search, search estimate, and search will match endpoints.

roamye commented 2 months ago

Unblocking this issue based on these two comment: https://github.com/project-lux/lux-marklogic/issues/89#issuecomment-2275809627 & https://github.com/project-lux/lux-marklogic/issues/89#issuecomment-2292313828

roamye commented 2 months ago

@brent-hartwig - who should this be assigned to? @clarkepeterf?

Also this never went through the UAT and will have to be moved to prioritization review to be reviewed tomorrow.