You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an API request to MPS is aborted for whatever reason (browser 'reload', browser window/tab closed, 'back' in the browser?), the AMT channel being used by that request isn't closed. Eventually, the device runs out of channels and API calls fail.
To Reproduce 🪜
Steps to reproduce the behavior:
Set silly level logging.
On a device page, hit reload several times before the page finishes loading. Some API failures messages will probably show briefly.
Note in the MPS logs that there are completed API calls without an associated channel close.
Expected behavior
AMT channels should be closed immediately after an API call completes.
AMT Device (please complete the following information): 🖥️
OS: N/A
AMT Version: N/A
AMT Configuration Mode: N/A
Network Configuration N/A
Service Deployment (please complete the following information): ⛈️
Deployment Type: Docker
Node Version: 16
Component & Version: 2.6.0
Additional context
Note that eventually, the device will timeout the orphaned channels and reloading the device page will succeed.
MPS is relying on either of the 'close' and 'finish' events being emitted by the Response object to close the AMT channel. In this case, neither are emitted.
The only event I've found to be emitted is 'aborted' on the Request object.
The obvious fix is to also close the channel on an aborted request, something like:
However, on reviewing nodejs issues re: which events are emitted when, I could not trust that this is the only event we might miss resulting in leaking AMT channels, or even that the 'aborted' event on the Request object is how they'll handle such cases in the future.
or similar to the end of each API, after the existing try-catch block to ensure any channel created would be properly closed. It is rather tedious though.
The text was updated successfully, but these errors were encountered:
orinem
added a commit
to orinem/mps
that referenced
this issue
Nov 27, 2022
Describe the bug 🪲
If an API request to MPS is aborted for whatever reason (browser 'reload', browser window/tab closed, 'back' in the browser?), the AMT channel being used by that request isn't closed. Eventually, the device runs out of channels and API calls fail.
To Reproduce 🪜
Steps to reproduce the behavior:
Set silly level logging.
On a device page, hit reload several times before the page finishes loading. Some API failures messages will probably show briefly.
Note in the MPS logs that there are completed API calls without an associated channel close.
Expected behavior
AMT channels should be closed immediately after an API call completes.
AMT Device (please complete the following information): 🖥️
Service Deployment (please complete the following information): ⛈️
Additional context
Note that eventually, the device will timeout the orphaned channels and reloading the device page will succeed.
MPS is relying on either of the 'close' and 'finish' events being emitted by the Response object to close the AMT channel. In this case, neither are emitted.
The only event I've found to be emitted is 'aborted' on the Request object.
The obvious fix is to also close the channel on an aborted request, something like:
However, on reviewing nodejs issues re: which events are emitted when, I could not trust that this is the only event we might miss resulting in leaking AMT channels, or even that the 'aborted' event on the Request object is how they'll handle such cases in the future.
A better solution IMO is to add:
or similar to the end of each API, after the existing try-catch block to ensure any channel created would be properly closed. It is rather tedious though.
The text was updated successfully, but these errors were encountered: