Clear Filters
Clear Filters

127.0.0.1:31516 - Message service fatally disconnected

96 views (last 30 days)
Hi,
I have a problem with Matlab (both R2023b and R2024a) not being able to resume after PC wakes from sleep mode. If Matlab is open when trying to put my PC to sleep, it stalls for several minutes preventing it from sleeping (until some process times out I guess and it finally enters sleep mode). Then, after it wakes, Matlab throws this error that Message service was disconnected at a specific localhost port (see title, the port number can vary). I followed advice from other posts (https://www.mathworks.com/matlabcentral/answers/514453-message-service-fatally-disconnected, https://www.mathworks.com/matlabcentral/answers/1637690-session-locks-when-connected-to-internet-after-disconnect-it-eventually-unlocks-with-matlab-error, and links within) that suggested to reset the preferences folder in AppData and download help documentation to local storage, but neither helped. This issue started in R2023b, recently I've upgraded to R2024a, but the issue still persists (this means I have a fresh install of R2024a that does this).
This disconnect issue causes the session to "freeze" - I can still write code into scripts and the GUI still responds, but I cannot execute any lines, and any edits in scripts cannot be saved (meaning that anything I write/edit will be lost). Restarting Matlab "fixes" this (until the next sleep mode), but that is not a solution for me. I use Windows 11 Home 23H2 with a Ryzen 3600, the Matlab is an Academic Total Headcount licence if any of that matters.
  1 Comment
Eddie
Eddie on 22 May 2024
Edited: Eddie on 22 May 2024
I have exactly the same issue, running 2023b/2024a on my Win11 PC. I'm glad I'm not alone. Frequently after I resume from hibernation, MATLAB throws a '127.0.0.1:31516 Message Service fatally disconnected.' error and the editor becomes completely non-functional. I've also tried resetting the preference folder in 2023b, and my 2024a is also a fresh install.
Initially, I suspect this has something to do my firewall/VPN/proxy software usage. After investigating all of those, this issue still persists. This never happens in R2022b if I recall correctly. I also found that the installation size shrank a lot since R2023 as local documentation is not installed by default, which might be a cuprit as suggest by some. Previously, I have similar freezing issue with my compiled uifigure-based GUI when my firewall blocks localhost for the GUI. So some software interference with localhost could still be at play. Next, I may try if I can reproduce this in a vanilla VM environment.

Sign in to comment.

Answers (1)

Siraj
Siraj on 4 Jun 2024
Hi!
I understand you're experiencing an error in MATLAB when your PC wakes from sleep mode, displaying the message:
"Message service fatally disconnected."
Additionally, if MATLAB is running as the PC enters sleep mode, it may stall for several minutes, and upon waking, MATLAB throws the aforementioned error.
The following workaround might solve this issue, but please be aware that all your MATLAB settings will be deleted by this workaround.
Therefore, it's crucial to back up your "pathdef.m" file first. You can locate this file by executing the command below in the MATLAB Command Window:
>> which -all pathdef
Before proceeding, ensure you copy this file to a safe location outside of your MATLAB path to preserve it.
After taking the backup, please execute the following commands in the MATLAB Command Window to restore the default MATLAB search path and rehash the toolbox cache:
>> restoredefaultpath
>> rehash toolboxcache
>> sl_refresh_customizations
After completing these steps, please use MATLAB again to check if the issue has been resolved. If the error no longer occurs, you may want to save the new MATLAB search path with the command:
>> savepath
If the issue still persists, repeat the above steps and additionally reset your "prefdir" directory by following these instructions:
  1. Open MATLAB.
  2. Type "prefdir" in the command window. You'll see an output similar to: 'C:\Users<username>\AppData\Roaming\MathWorks\MATLAB\R2024a'.
  3. Close MATLAB.
  4. Using your preferred file explorer, navigate to the directory indicated by prefdir.
  5. Rename the directory (e.g., from R2024a to R2024a_temp).
  6. Reopen MATLAB R2024a. A new folder named "R2024a" will be created, restoring the initial settings.
I hope this resolves your issue.
If none of the above is helpful, you can reach out to MathWorks for support through this link: https://www.mathworks.com/support/contact_us.html
  1 Comment
Tomas Malina
Tomas Malina on 6 Jun 2024
Hi, thanks for the tip, I followed your advice and started matlab. First time I put my PC into sleep mode with Matlab open the "falling aslleep" was fast, but upon waking, Matlab showed a wall of errors in the command window:
java.lang.IllegalArgumentException: No root node exists
at com.mathworks.peermodel.impl.PeerModelManagerImpl.getById(PeerModelManagerImpl.java:213)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.subTreeAddedSubscriber(PeerSynchronizer.java:341)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.handle(PeerSynchronizer.java:780)
at com.mathworks.connector.message_service.impl.MessageServiceJSONImpl.handlePublishRequest(MessageServiceJSONImpl.java:29)
at com.mathworks.connector.message_service.impl.AbstractMessageService.handlePublishRequest(AbstractMessageService.java:72)
at com.mathworks.connector.message_service.impl.JniMessageServiceAdaptorImpl.doHandlePublish(JniMessageServiceAdaptorImpl.java:59)
at com.mathworks.connector.message_service.api.JniMessageServiceAdaptor.fromNative(JniMessageServiceAdaptor.java:21)
Message that caused error: namespace=/actions/liveeditor/1664516399, channel=/peermodel/actions/liveeditor/1664516399/subTreeAdded, data={index=311.0, message=4.0, parentId=EEE181FC, child={index=0.0, id=27208CC9, type=Action, properties={id=rtc_publish_dialog, enabled=true, isLocal=true}}}
java.lang.IllegalArgumentException: No root node exists
at com.mathworks.peermodel.impl.PeerModelManagerImpl.getById(PeerModelManagerImpl.java:213)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.subTreeAddedSubscriber(PeerSynchronizer.java:341)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.handle(PeerSynchronizer.java:780)
at com.mathworks.connector.message_service.impl.MessageServiceJSONImpl.handlePublishRequest(MessageServiceJSONImpl.java:29)
at com.mathworks.connector.message_service.impl.AbstractMessageService.handlePublishRequest(AbstractMessageService.java:72)
at com.mathworks.connector.message_service.impl.JniMessageServiceAdaptorImpl.doHandlePublish(JniMessageServiceAdaptorImpl.java:59)
at com.mathworks.connector.message_service.api.JniMessageServiceAdaptor.fromNative(JniMessageServiceAdaptor.java:21)
Message that caused error: namespace=/actions/liveeditor/1664516399, channel=/peermodel/actions/liveeditor/1664516399/subTreeAdded, data={index=312.0, message=6.0, parentId=EEE181FC, child={index=0.0, id=A068C8A4, type=Action, properties={id=rtc_publish_most_recent, enabled=true, isLocal=true}}}
java.lang.IllegalArgumentException: No root node exists
at com.mathworks.peermodel.impl.PeerModelManagerImpl.getById(PeerModelManagerImpl.java:213)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.subTreeAddedSubscriber(PeerSynchronizer.java:341)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.handle(PeerSynchronizer.java:780)
at com.mathworks.connector.message_service.impl.MessageServiceJSONImpl.handlePublishRequest(MessageServiceJSONImpl.java:29)
at com.mathworks.connector.message_service.impl.AbstractMessageService.handlePublishRequest(AbstractMessageService.java:72)
at com.mathworks.connector.message_service.impl.JniMessageServiceAdaptorImpl.doHandlePublish(JniMessageServiceAdaptorImpl.java:59)
at com.mathworks.connector.message_service.api.JniMessageServiceAdaptor.fromNative(JniMessageServiceAdaptor.java:21)
Message that caused error: namespace=/actions/liveeditor/1917698791, channel=/peermodel/actions/liveeditor/1917698791/subTreeAdded, data={index=311.0, message=4.0, parentId=B56667C5, child={index=0.0, id=9F808104, type=Action, properties={id=rtc_publish_dialog, enabled=true, isLocal=true}}}
java.lang.IllegalArgumentException: No root node exists
at com.mathworks.peermodel.impl.PeerModelManagerImpl.getById(PeerModelManagerImpl.java:213)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.subTreeAddedSubscriber(PeerSynchronizer.java:341)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.handle(PeerSynchronizer.java:780)
at com.mathworks.connector.message_service.impl.MessageServiceJSONImpl.handlePublishRequest(MessageServiceJSONImpl.java:29)
at com.mathworks.connector.message_service.impl.AbstractMessageService.handlePublishRequest(AbstractMessageService.java:72)
at com.mathworks.connector.message_service.impl.JniMessageServiceAdaptorImpl.doHandlePublish(JniMessageServiceAdaptorImpl.java:59)
at com.mathworks.connector.message_service.api.JniMessageServiceAdaptor.fromNative(JniMessageServiceAdaptor.java:21)
Message that caused error: namespace=/actions/liveeditor/1917698791, channel=/peermodel/actions/liveeditor/1917698791/subTreeAdded, data={index=312.0, message=6.0, parentId=B56667C5, child={index=0.0, id=78529A97, type=Action, properties={id=rtc_publish_most_recent, enabled=true, isLocal=true}}}
java.lang.IllegalArgumentException: No root node exists
at com.mathworks.peermodel.impl.PeerModelManagerImpl.getById(PeerModelManagerImpl.java:213)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.subTreeAddedSubscriber(PeerSynchronizer.java:341)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.handle(PeerSynchronizer.java:780)
at com.mathworks.connector.message_service.impl.MessageServiceJSONImpl.handlePublishRequest(MessageServiceJSONImpl.java:29)
at com.mathworks.connector.message_service.impl.AbstractMessageService.handlePublishRequest(AbstractMessageService.java:72)
at com.mathworks.connector.message_service.impl.JniMessageServiceAdaptorImpl.doHandlePublish(JniMessageServiceAdaptorImpl.java:59)
at com.mathworks.connector.message_service.api.JniMessageServiceAdaptor.fromNative(JniMessageServiceAdaptor.java:21)
Message that caused error: namespace=/actions/liveeditor/1286160050, channel=/peermodel/actions/liveeditor/1286160050/subTreeAdded, data={index=311.0, message=4.0, parentId=B1FFC85F, child={index=0.0, id=17F68678, type=Action, properties={id=rtc_publish_dialog, enabled=true, isLocal=true}}}
java.lang.IllegalArgumentException: No root node exists
at com.mathworks.peermodel.impl.PeerModelManagerImpl.getById(PeerModelManagerImpl.java:213)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.subTreeAddedSubscriber(PeerSynchronizer.java:341)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.handle(PeerSynchronizer.java:780)
at com.mathworks.connector.message_service.impl.MessageServiceJSONImpl.handlePublishRequest(MessageServiceJSONImpl.java:29)
at com.mathworks.connector.message_service.impl.AbstractMessageService.handlePublishRequest(AbstractMessageService.java:72)
at com.mathworks.connector.message_service.impl.JniMessageServiceAdaptorImpl.doHandlePublish(JniMessageServiceAdaptorImpl.java:59)
at com.mathworks.connector.message_service.api.JniMessageServiceAdaptor.fromNative(JniMessageServiceAdaptor.java:21)
Message that caused error: namespace=/actions/liveeditor/1286160050, channel=/peermodel/actions/liveeditor/1286160050/subTreeAdded, data={index=312.0, message=6.0, parentId=B1FFC85F, child={index=0.0, id=ED485362, type=Action, properties={id=rtc_publish_most_recent, enabled=true, isLocal=true}}}
java.lang.IllegalArgumentException: No root node exists
at com.mathworks.peermodel.impl.PeerModelManagerImpl.getById(PeerModelManagerImpl.java:213)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.subTreeAddedSubscriber(PeerSynchronizer.java:341)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.handle(PeerSynchronizer.java:780)
at com.mathworks.connector.message_service.impl.MessageServiceJSONImpl.handlePublishRequest(MessageServiceJSONImpl.java:29)
at com.mathworks.connector.message_service.impl.AbstractMessageService.handlePublishRequest(AbstractMessageService.java:72)
at com.mathworks.connector.message_service.impl.JniMessageServiceAdaptorImpl.doHandlePublish(JniMessageServiceAdaptorImpl.java:59)
at com.mathworks.connector.message_service.api.JniMessageServiceAdaptor.fromNative(JniMessageServiceAdaptor.java:21)
Message that caused error: namespace=/actions/liveeditor/521467541, channel=/peermodel/actions/liveeditor/521467541/subTreeAdded, data={index=311.0, message=4.0, parentId=B7197C80, child={index=0.0, id=3C97BF44, type=Action, properties={id=rtc_publish_dialog, enabled=true, isLocal=true}}}
java.lang.IllegalArgumentException: No root node exists
at com.mathworks.peermodel.impl.PeerModelManagerImpl.getById(PeerModelManagerImpl.java:213)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.subTreeAddedSubscriber(PeerSynchronizer.java:341)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.handle(PeerSynchronizer.java:780)
at com.mathworks.connector.message_service.impl.MessageServiceJSONImpl.handlePublishRequest(MessageServiceJSONImpl.java:29)
at com.mathworks.connector.message_service.impl.AbstractMessageService.handlePublishRequest(AbstractMessageService.java:72)
at com.mathworks.connector.message_service.impl.JniMessageServiceAdaptorImpl.doHandlePublish(JniMessageServiceAdaptorImpl.java:59)
at com.mathworks.connector.message_service.api.JniMessageServiceAdaptor.fromNative(JniMessageServiceAdaptor.java:21)
Message that caused error: namespace=/actions/liveeditor/521467541, channel=/peermodel/actions/liveeditor/521467541/subTreeAdded, data={index=312.0, message=6.0, parentId=B7197C80, child={index=0.0, id=49F04BE9, type=Action, properties={id=rtc_publish_most_recent, enabled=true, isLocal=true}}}
java.lang.IllegalArgumentException: No root node exists
at com.mathworks.peermodel.impl.PeerModelManagerImpl.getById(PeerModelManagerImpl.java:213)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.subTreeAddedSubscriber(PeerSynchronizer.java:341)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.handle(PeerSynchronizer.java:780)
at com.mathworks.connector.message_service.impl.MessageServiceJSONImpl.handlePublishRequest(MessageServiceJSONImpl.java:29)
at com.mathworks.connector.message_service.impl.AbstractMessageService.handlePublishRequest(AbstractMessageService.java:72)
at com.mathworks.connector.message_service.impl.JniMessageServiceAdaptorImpl.doHandlePublish(JniMessageServiceAdaptorImpl.java:59)
at com.mathworks.connector.message_service.api.JniMessageServiceAdaptor.fromNative(JniMessageServiceAdaptor.java:21)
Message that caused error: namespace=/actions/liveeditor/302469078, channel=/peermodel/actions/liveeditor/302469078/subTreeAdded, data={index=311.0, message=4.0, parentId=D4EFA076, child={index=0.0, id=EC32FFF8, type=Action, properties={id=rtc_publish_dialog, enabled=true, isLocal=true}}}
java.lang.IllegalArgumentException: No root node exists
at com.mathworks.peermodel.impl.PeerModelManagerImpl.getById(PeerModelManagerImpl.java:213)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.subTreeAddedSubscriber(PeerSynchronizer.java:341)
at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.handle(PeerSynchronizer.java:780)
at com.mathworks.connector.message_service.impl.MessageServiceJSONImpl.handlePublishRequest(MessageServiceJSONImpl.java:29)
at com.mathworks.connector.message_service.impl.AbstractMessageService.handlePublishRequest(AbstractMessageService.java:72)
at com.mathworks.connector.message_service.impl.JniMessageServiceAdaptorImpl.doHandlePublish(JniMessageServiceAdaptorImpl.java:59)
at com.mathworks.connector.message_service.api.JniMessageServiceAdaptor.fromNative(JniMessageServiceAdaptor.java:21)
Message that caused error: namespace=/actions/liveeditor/302469078, channel=/peermodel/actions/liveeditor/302469078/subTreeAdded, data={index=312.0, message=6.0, parentId=D4EFA076, child={index=0.0, id=FBA96C90, type=Action, properties={id=rtc_publish_most_recent, enabled=true, isLocal=true}}}
java.lang.ArrayIndexOutOfBoundsException: 333
at com.mathworks.peermodel.impl.PeerModelManagerImpl.updateChildren(PeerModelManagerImpl.java:584)
at com.mathworks.peermodel.impl.PeerModelManagerImpl.updateNodeRecursiveFromSnapshot(PeerModelManagerImpl.java:509)
at com.mathworks.peermodel.impl.PeerModelManagerImpl.mergeFromSnapshot(PeerModelManagerImpl.java:441)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.fullUpdateSubscriber(PeerSynchronizer.java:226)
at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.mathworks.peermodel.synchronizer.PeerSynchronizer.handle(PeerSynchronizer.java:780)
at com.mathworks.connector.message_service.impl.MessageServiceJSONImpl.handlePublishRequest(MessageServiceJSONImpl.java:29)
at com.mathworks.connector.message_service.impl.AbstractMessageService.handlePublishRequest(AbstractMessageService.java:72)
at com.mathworks.connector.message_service.impl.JniMessageServiceAdaptorImpl.doHandlePublish(JniMessageServiceAdaptorImpl.java:59)
at com.mathworks.connector.message_service.api.JniMessageServiceAdaptor.fromNative(JniMessageServiceAdaptor.java:21)
Message that caused error: namespace=/actions/liveeditor/1524613256, channel=/peermodel/actions/liveeditor/1524613256/fullUpdate, data={root={children=[Ljava.util.HashMap;@2e66561f, index=0.0, id=70A37013, type=Root, properties={}}, message=905.0}
I restarted Matlab again and I am back to the same problem, where sleeping hangs and I get a fatal disconnect after waking (without the wall of errors this time).

Sign in to comment.

Categories

Find more on Programming Utilities in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!