127.0.0.1:31516 - Message service fatally disconnected
91 次查看(过去 30 天)
显示 更早的评论
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 个评论
Eddie
2024-5-22
编辑:Eddie
2024-5-22
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.
回答(1 个)
Siraj
2024-6-4
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:
- Open MATLAB.
- Type "prefdir" in the command window. You'll see an output similar to: 'C:\Users<username>\AppData\Roaming\MathWorks\MATLAB\R2024a'.
- Close MATLAB.
- Using your preferred file explorer, navigate to the directory indicated by prefdir.
- Rename the directory (e.g., from R2024a to R2024a_temp).
- 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
3 个评论
David Young
2024-7-29
Please would you explain why you advise making a copy of pathdef.m. Your instructions don't seem to use the copy in any way - is it useful for reinstating options?
Victor Manuel Peñaranda Vélez
2024-8-6
Thank you for your help. Your suggestions work in my system. I have MALTAB R2022a and once it starts the following message appears "Message Service fatally disconnected". Then, I followed the steps you had indicated and they work perfectly.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!