Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking if the executor pool is shutdown before executing #276

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

notthetup
Copy link
Collaborator

@notthetup notthetup commented Mar 21, 2023

ConnectionHandler uses SingleThreadExecutor to send messages on a given Connector. If the Connector stops, it can cause the ExecutorPool to be stopped. So we need to check if the Executor has not stopped before trying to send something on the connector.

@notthetup notthetup requested a review from mchitre March 21, 2023 07:12
@notthetup notthetup self-assigned this Mar 21, 2023
Copy link
Member

@mchitre mchitre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the symptom that this fixes?

@notthetup
Copy link
Collaborator Author

notthetup commented Mar 22, 2023

This was happening when a SlaveContainer stopped responding and the connection on the MasterContainer closed. If some Agent was still trying to send a response to some request from the SlaveContainer, it could cause an exception when sending.

1679368369915|INFO|org.arl.fjage.remote.MasterContainer@47:connectionClosed|Connection tcp:///127.0.1.1:1100//127.0.0.1.37286 closed
1679368369941|SEVERE|org.arl.unet.nodeinfo.NodeInfo/audio@44:run|Exception in agent: node

java.util.concurrent.RejectedExecutionException: Task org.arl.fjage.remote.ConnectionHandler$$Lambda$236/1911266333@50ecfb8c rejected from java.util.concurrent.ThreadPoolExecutor@50a52d2b[Shutting down, pool size = 1, active threads = 1, queued tasks = 1, completed tasks = 2]
Stack trace: ...
   org.arl.fjage.remote.ConnectionHandler.printlnQueued(ConnectionHandler.java:229)
   org.arl.fjage.remote.MasterContainer.send(MasterContainer.java:235)
   org.arl.fjage.remote.MasterContainer.send(MasterContainer.java:216)
   org.arl.fjage.Agent.send(Agent.java:411)
    ...

@notthetup notthetup merged commit 742114e into master Mar 22, 2023
@notthetup notthetup deleted the connection-handler-exception branch March 22, 2023 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants