Control server needs to be restarted on emergency shut down
-
This is a follow up to my first post https://forum.duet3d.com/topic/30087/web-ui-asking-for-password-after-emergency-stop/
I did more testing and looked at the web server logs, and here is what happen when I press the "emergency shutdown" button:
Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 POST http://3d.goyman.com/machine/code text/plain;charset=UTF-8 9 Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[5] CORS policy execution failed. Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[6] Request origin http://3d.goyman.com does not have permission to access the resource. Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'DuetWebServer.Controllers.MachineController.DoCode (DuetWebServer)' Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "DoCode", controller = "Machine"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] DoCode(DuetWebServer.Singletons.ISessionStorage, Boolean) on controller DuetWebServer.Controllers.MachineController (DuetWebServer). Nov 07 01:03:48 lili DuetWebServer[543]: DuetWebServer.Singletons.SessionStorage[0] Session 2ce98fcbfae64345ae525e2494b1f692 started a long-running request Nov 07 01:03:48 lili DuetWebServer[543]: DuetWebServer.Controllers.MachineController[0] [DoCode] Executing code 'M112 M999' Nov 07 01:03:48 lili DuetWebServer[543]: DuetWebServer.Singletons.SessionStorage[0] Session 2ce98fcbfae64345ae525e2494b1f692 finished a long-running request Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ContentResultExecutor[1] Executing ContentResult with HTTP Response ContentType of text/plain; charset=utf-8 Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2] Executed action DuetWebServer.Controllers.MachineController.DoCode (DuetWebServer) in 373.1227ms Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint 'DuetWebServer.Controllers.MachineController.DoCode (DuetWebServer)' Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 POST http://3d.goyman.com/machine/code text/plain;charset=UTF-8 9 - 200 0 text/plain;+charset=utf-8 378.7021ms Nov 07 01:03:48 lili DuetWebServer[543]: DuetWebServer.Controllers.WebSocketController[0] [WebSocketController] DCS has been stopped Nov 07 01:03:48 lili DuetWebServer[543]: DuetWebServer.Services.ModelObserver[0] Failed to synchronize machine model System.Net.Sockets.SocketException (107): Transport endpoint is not connected at DuetAPI.Utility.JsonHelper.ReceiveUtf8Json(Socket socket, CancellationToken cancellationToken) in /home/christian/Duet3D/DuetSoftwareFramework/src/DuetAPI/Utility/JsonHelper.cs:line 143 at DuetAPIClient.BaseConnection.ReceiveJson(CancellationToken cancellationToken) in /home/christian/Duet3D/DuetSoftwareFramework/src/DuetAPIClient/BaseConnection.cs:line 259 at DuetAPIClient.SubscribeConnection.GetObjectModelPatch(CancellationToken cancellationToken) in /home/christian/Duet3D/DuetSoftwareFramework/src/DuetAPIClient/ModelSubscription/SubscribeConnection.cs:line 235 at DuetWebServer.Services.ModelObserver.Execute() in /home/christian/Duet3D/DuetSoftwareFramework/src/DuetWebServer/Services/ModelObserver.cs:line 190 Nov 07 01:03:48 lili DuetWebServer[543]: DuetWebServer.Controllers.WebSocketController[0] WebSocket disconnected from 2a02:aa08:e000:abab::100:1:34262 Nov 07 01:03:48 lili DuetWebServer[543]: DuetWebServer.Singletons.SessionStorage[0] Session 2ce98fcbfae64345ae525e2494b1f692 unregistered a WebSocket connection Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/machine/connect?password=reprap - - Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2] Executed action DuetWebServer.Controllers.WebSocketController.Get (DuetWebServer) in 427489.5842ms Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint 'DuetWebServer.Controllers.WebSocketController.Get (DuetWebServer)' Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/machine?sessionKey=2ce98fcbfae64345ae525e2494b1f692 - - - 101 - - 427501.9893ms Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'DuetWebServer.Controllers.MachineController.Connect (DuetWebServer)' Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "Connect", controller = "Machine"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Connect(System.String, DuetWebServer.Singletons.ISessionStorage) on controller DuetWebServer.Controllers.MachineController (DuetWebServer). Nov 07 01:03:48 lili DuetWebServer[543]: DuetWebServer.Controllers.MachineController[0] [Connect] DCS is not started Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1] Executing ObjectResult, writing value of type 'System.String'. Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2] Executed action DuetWebServer.Controllers.MachineController.Connect (DuetWebServer) in 3.2802ms Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint 'DuetWebServer.Controllers.MachineController.Connect (DuetWebServer)' Nov 07 01:03:48 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/machine/connect?password=reprap - - - 503 - text/plain;+charset=utf-8 16.9799ms Nov 07 01:03:50 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/machine/connect?password=reprap - - Nov 07 01:03:50 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'DuetWebServer.Controllers.MachineController.Connect (DuetWebServer)' Nov 07 01:03:50 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "Connect", controller = "Machine"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Connect(System.String, DuetWebServer.Singletons.ISessionStorage) on controller DuetWebServer.Controllers.MachineController (DuetWebServer). Nov 07 01:03:50 lili DuetWebServer[543]: DuetWebServer.Singletons.SessionStorage[0] Session 0081d1cc81bd4911824c5b85889db5cc added (readWrite) Nov 07 01:03:50 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ContentResultExecutor[1] Executing ContentResult with HTTP Response ContentType of application/json Nov 07 01:03:50 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2] Executed action DuetWebServer.Controllers.MachineController.Connect (DuetWebServer) in 75.2831ms Nov 07 01:03:50 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint 'DuetWebServer.Controllers.MachineController.Connect (DuetWebServer)' Nov 07 01:03:50 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/machine/connect?password=reprap - - - 200 49 application/json 251.8420ms Nov 07 01:03:50 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/machine?sessionKey=0081d1cc81bd4911824c5b85889db5cc - - Nov 07 01:03:50 lili DuetWebServer[543]: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[5] CORS policy execution failed. Nov 07 01:03:50 lili DuetWebServer[543]: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[6] Request origin http://3d.goyman.com does not have permission to access the resource. Nov 07 01:03:51 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'DuetWebServer.Controllers.WebSocketController.Get (DuetWebServer)' Nov 07 01:03:51 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "Get", controller = "WebSocket"}. Executing controller action with signature System.Threading.Tasks.Task Get(System.String, DuetWebServer.Singletons.ISessionStorage) on controller DuetWebServer.Controllers.WebSocketController (DuetWebServer). Nov 07 01:03:51 lili DuetWebServer[543]: DuetWebServer.Singletons.SessionStorage[0] Session 0081d1cc81bd4911824c5b85889db5cc registered a WebSocket connection Nov 07 01:03:51 lili DuetWebServer[543]: DuetWebServer.Controllers.WebSocketController[0] WebSocket connected from 2a02:aa08:e000:abab::100:1:50036 Nov 07 01:03:51 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/machine/directory/0:%2Fmacros - - Nov 07 01:03:51 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'DuetWebServer.Controllers.MachineController.GetFileList (DuetWebServer)' Nov 07 01:03:51 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "GetFileList", controller = "Machine"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] GetFileList(System.String) on controller DuetWebServer.Controllers.MachineController (DuetWebServer). Nov 07 01:03:51 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ContentResultExecutor[1] Executing ContentResult with HTTP Response ContentType of application/json Nov 07 01:03:51 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2] Executed action DuetWebServer.Controllers.MachineController.GetFileList (DuetWebServer) in 62.1671ms Nov 07 01:03:51 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint 'DuetWebServer.Controllers.MachineController.GetFileList (DuetWebServer)' Nov 07 01:03:51 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/machine/directory/0:%2Fmacros - - - 200 787 application/json 64.2493ms Nov 07 01:03:53 lili DuetWebServer[543]: DuetWebServer.Services.ModelObserver[0] Connections to DuetControlServer established Nov 07 01:03:57 lili DuetWebServer[543]: DuetWebServer.Singletons.SessionStorage[0] Session 2ce98fcbfae64345ae525e2494b1f692 expired
At this point, the web UI is asking for password and remote API don't work (for example from prusa if I send a job I get a 401).
If I reload the Web UI page, I get this log:
Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/ - - Nov 07 01:04:42 lili DuetWebServer[543]: DuetWebServer.Authorization.SessionKeyAuthenticationHandler[7] SessionKey was not authenticated. Failure message: Missing X-Session-Key header Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[6] The file /index.html was not modified Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/ - - - 304 - text/html 28.5695ms Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/rr_connect?password=reprap&time=2022-11-07T01%3A04%3A42 - - Nov 07 01:04:42 lili DuetWebServer[543]: DuetWebServer.Authorization.SessionKeyAuthenticationHandler[7] SessionKey was not authenticated. Failure message: Missing X-Session-Key header Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/rr_connect?password=reprap&time=2022-11-07T01%3A04%3A42 - - - 404 0 - 18.1276ms Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/machine/connect?password=reprap - - Nov 07 01:04:42 lili DuetWebServer[543]: DuetWebServer.Authorization.SessionKeyAuthenticationHandler[7] SessionKey was not authenticated. Failure message: Missing X-Session-Key header Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'DuetWebServer.Controllers.MachineController.Connect (DuetWebServer)' Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "Connect", controller = "Machine"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Connect(System.String, DuetWebServer.Singletons.ISessionStorage) on controller DuetWebServer.Controllers.MachineController (DuetWebServer). Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.ForbidResult[1] Executing ForbidResult with authentication schemes (). Nov 07 01:04:42 lili DuetWebServer[543]: DuetWebServer.Authorization.SessionKeyAuthenticationHandler[13] AuthenticationScheme: SessionKey was forbidden. Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2] Executed action DuetWebServer.Controllers.MachineController.Connect (DuetWebServer) in 18.2591ms Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint 'DuetWebServer.Controllers.MachineController.Connect (DuetWebServer)' Nov 07 01:04:42 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/machine/connect?password=reprap - - - 403 0 - 34.9756ms Nov 07 01:04:43 lili DuetWebServer[543]: DuetWebServer.Singletons.SessionStorage[0] Session 0081d1cc81bd4911824c5b85889db5cc expired
Now, if I restart the controler server, here is the log of the web server:
Nov 07 01:06:00 lili DuetWebServer[543]: DuetWebServer.Services.ModelObserver[0] Failed to synchronize machine model System.Net.Sockets.SocketException (107): Transport endpoint is not connected at DuetAPI.Utility.JsonHelper.ReceiveUtf8Json(Socket socket, CancellationToken cancellationToken) in /home/christian/Duet3D/DuetSoftwareFramework/src/DuetAPI/Utility/JsonHelper.cs:line 143 at DuetAPIClient.BaseConnection.ReceiveJson(CancellationToken cancellationToken) in /home/christian/Duet3D/DuetSoftwareFramework/src/DuetAPIClient/BaseConnection.cs:line 259 at DuetAPIClient.SubscribeConnection.GetObjectModelPatch(CancellationToken cancellationToken) in /home/christian/Duet3D/DuetSoftwareFramework/src/DuetAPIClient/ModelSubscription/SubscribeConnection.cs:line 235 at DuetWebServer.Services.ModelObserver.Execute() in /home/christian/Duet3D/DuetSoftwareFramework/src/DuetWebServer/Services/ModelObserver.cs:line 190 Nov 07 01:06:05 lili DuetWebServer[543]: DuetWebServer.Services.ModelObserver[0] Connections to DuetControlServer established
-
At this point, the web ui works without asking for a password and remote api works, and if I reload the web ui, I get this logs:
Nov 07 01:06:12 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/ - - Nov 07 01:06:12 lili DuetWebServer[543]: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[6] The file /index.html was not modified Nov 07 01:06:12 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/ - - - 304 - text/html 41.1221ms Nov 07 01:06:13 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/rr_connect?password=reprap&time=2022-11-07T01%3A06%3A13 - - Nov 07 01:06:13 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/rr_connect?password=reprap&time=2022-11-07T01%3A06%3A13 - - - 404 0 - 10.3325ms Nov 07 01:06:13 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/machine/connect?password=reprap - - Nov 07 01:06:13 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'DuetWebServer.Controllers.MachineController.Connect (DuetWebServer)' Nov 07 01:06:13 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "Connect", controller = "Machine"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Connect(System.String, DuetWebServer.Singletons.ISessionStorage) on controller DuetWebServer.Controllers.MachineController (DuetWebServer). Nov 07 01:06:13 lili DuetWebServer[543]: DuetWebServer.Singletons.SessionStorage[0] Session b91df835fcf048668f2c833d5da928e4 added (readWrite) Nov 07 01:06:13 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ContentResultExecutor[1] Executing ContentResult with HTTP Response ContentType of application/json Nov 07 01:06:13 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2] Executed action DuetWebServer.Controllers.MachineController.Connect (DuetWebServer) in 64.2328ms Nov 07 01:06:13 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint 'DuetWebServer.Controllers.MachineController.Connect (DuetWebServer)' Nov 07 01:06:13 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/machine/connect?password=reprap - - - 200 49 application/json 74.5523ms Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/machine?sessionKey=b91df835fcf048668f2c833d5da928e4 - - Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[5] CORS policy execution failed. Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Cors.Infrastructure.CorsService[6] Request origin http://3d.goyman.com does not have permission to access the resource. Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'DuetWebServer.Controllers.WebSocketController.Get (DuetWebServer)' Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "Get", controller = "WebSocket"}. Executing controller action with signature System.Threading.Tasks.Task Get(System.String, DuetWebServer.Singletons.ISessionStorage) on controller DuetWebServer.Controllers.WebSocketController (DuetWebServer). Nov 07 01:06:18 lili DuetWebServer[543]: DuetWebServer.Singletons.SessionStorage[0] Session b91df835fcf048668f2c833d5da928e4 registered a WebSocket connection Nov 07 01:06:18 lili DuetWebServer[543]: DuetWebServer.Controllers.WebSocketController[0] WebSocket connected from 2a02:aa08:e000:abab::100:1:47034 Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/machine/directory/0:%2Fmacros%2F - - Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'DuetWebServer.Controllers.MachineController.GetFileList (DuetWebServer)' Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "GetFileList", controller = "Machine"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] GetFileList(System.String) on controller DuetWebServer.Controllers.MachineController (DuetWebServer). Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/machine/file/0:%2Fsys%2Fdwc-settings.json - - Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'DuetWebServer.Controllers.MachineController.DownloadFile (DuetWebServer)' Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ContentResultExecutor[1] Executing ContentResult with HTTP Response ContentType of application/json Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3] Route matched with {action = "DownloadFile", controller = "Machine"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] DownloadFile(System.String) on controller DuetWebServer.Controllers.MachineController (DuetWebServer). Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2] Executed action DuetWebServer.Controllers.MachineController.GetFileList (DuetWebServer) in 12.5238ms Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint 'DuetWebServer.Controllers.MachineController.GetFileList (DuetWebServer)' Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/machine/directory/0:%2Fmacros%2F - - - 200 787 application/json 13.1273ms Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.FileStreamResultExecutor[2] Executing FileStreamResult, sending file with download name '' ... Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2] Executed action DuetWebServer.Controllers.MachineController.DownloadFile (DuetWebServer) in 22.5037ms Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint 'DuetWebServer.Controllers.MachineController.DownloadFile (DuetWebServer)' Nov 07 01:06:18 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/machine/file/0:%2Fsys%2Fdwc-settings.json - - - 200 1417 application/octet-stream 23.1026ms Nov 07 01:06:19 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[1] Request starting HTTP/1.1 GET http://3d.goyman.com/js/ObjectModelBrowser.a6a80e4b.js - - Nov 07 01:06:19 lili DuetWebServer[543]: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[2] Sending file. Request path: '/js/ObjectModelBrowser.a6a80e4b.js'. Physical path: '/opt/dsf/sd/www/js/ObjectModelBrowser.a6a80e4b.js' Nov 07 01:06:19 lili DuetWebServer[543]: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/1.1 GET http://3d.goyman.com/js/ObjectModelBrowser.a6a80e4b.js - - - 0 31351 application/javascript 10.6610ms
-
@dc42 Do you have any pointer on how I can debug the issue? Having to restart the controlserver everytime I turn the printer on or press the emergency restart is a bit annoying.
-
@kuon one for @chrishamm
-
@chrishamm Any idea? I can provide more debug info if needed.
-
@kuon I am sorry it took a while to get back to you but I just had a chance to attempt to reproduce it and I didn't manage to provoke this problem. I set the password right at the top of my
config.g
with v3.4.4 and when I press E-STOP, DWC reconnects with the previously entered password even when I have two independent DWC sessions running in two different tabs.From your logs it appears you expose the web server to the internet, which is a scenario I have never set up (yet it should not make a difference). Can you confirm the same problem persists when you access your machine from your LAN?
-
@chrishamm The hostname is local LAN address. If I try with the IP directly I get the same result.
I noticed something, when the error is present, I get the following logs:
Nov 22 01:17:03 lili systemd[1]: Starting Duet Control Server... Nov 22 01:17:06 lili DuetControlServer[301]: Duet Control Server v3.4.4 Nov 22 01:17:06 lili DuetControlServer[301]: Written by Christian Hammacher for Duet3D Nov 22 01:17:06 lili DuetControlServer[301]: Licensed under the terms of the GNU Public License Version 3 Nov 22 01:17:07 lili DuetControlServer[301]: [info] Settings loaded Nov 22 01:17:07 lili DuetControlServer[301]: [info] Environment initialized Nov 22 01:17:07 lili DuetControlServer[301]: [info] Connection to Duet established Nov 22 01:17:08 lili DuetControlServer[301]: [info] IPC socket created at /run/dsf/dcs.sock Nov 22 01:17:08 lili systemd[1]: Started Duet Control Server. Nov 22 01:17:08 lili DuetControlServer[301]: [info] Starting macro file config.g on channel Trigger Nov 22 01:17:11 lili DuetControlServer[301]: [info] Finished macro file config.g
When I restart the server manually, I get this output:
Nov 22 14:32:00 lili systemd[1]: Starting Duet Control Server... Nov 22 14:32:00 lili DuetControlServer[905]: Duet Control Server v3.4.4 Nov 22 14:32:00 lili DuetControlServer[905]: Written by Christian Hammacher for Duet3D Nov 22 14:32:00 lili DuetControlServer[905]: Licensed under the terms of the GNU Public License Version 3 Nov 22 14:32:01 lili DuetControlServer[905]: [info] Settings loaded Nov 22 14:32:01 lili DuetControlServer[905]: [info] Environment initialized Nov 22 14:32:01 lili DuetControlServer[905]: [info] Connection to Duet established Nov 22 14:32:01 lili DuetControlServer[905]: [info] IPC socket created at /run/dsf/dcs.sock Nov 22 14:32:01 lili systemd[1]: Started Duet Control Server.
The two lines about
config.g
are missing, but in this case, it works and I can access the web UI.If I empty my config.g and only leave the password and hostname the issue persists.
-
@kuon Right,
config.g
is not executed when you restart the DSF service and DSF will keep using the default (unset) password, so actually you should put yourM551
intodsf-config.g
which is always executed when you restart the Pi or the DCS service in general.Please share your current
config.g
file, the only reason I can think of why it isn't working is an error somehwere in your configuration file.M551
works properly on my SBC setup no matter what I do. Note thatM551
and HTTP password protection wasn't supported in earlier DSF versions, so that might have just concealed the problem. -
@chrishamm As I said, I tried with a
config.g
containing only those two lines:M551 P"xxxx" ; printer password M550 P"lili" ; printer name
-
@kuon That works for me, I can repeatedly connect with "xxxx" as the password upon E-STOP using Firefox and MS Edge.
-
I realized something, if I restart the server with
sudo systemctl restart duetcontrolserver.service
then load the web UI (not prompted for password, so so far, so good), then I issue theM551
gcode using the UI, and after that hit F5 to reload the page, I am prompted for password, and if I enter the password it works, but if Ireload the page again, I still get prompted. It seems the session is not sticking.Is that intended behavior? Because maybe my
M551
was not being set and I was actually using the machine without a password. And also that prusa slicer is not supporting the proper way to use Duet API with a password. -
@kuon Yes, it is, see my previous comment.
config.g
is only executed when RRF starts but not when DCS is restarted, so you should put M550/M551 indsf-config.g
instead. The machine password is stored by DCS and not RRF, so it is cleared upon restart if it is only in config.g -
@chrishamm said in Control server needs to be restarted on emergency shut down:
@kuon Yes, it is, see my previous comment.
config.g
is only executed when RRF starts but not when DCS is restarted, so you should put M550/M551 indsf-config.g
instead. The machine password is stored by DCS and not RRF, so it is cleared upon restart if it is only in config.gdsf-config.g
must be activated in some way? Because I just tried and it has no effect. I added theM551
andM550
in it. (which I removed fromconfig.g
) The name in the UI defaults to the hostname of the PI instead of theM550
value I set.Also, is it normal that the UI prompt for password on each reload and that it does not set a persistent session?
-
@kuon is this a fresh install or have you been upgrading the SBC side for a while?
-
@jay_s_uk I have been upgrading for a long time, maybe that's what is causing the issue. I can try a fresh install.
-
@kuon i would try a fresh install because the duetpimanagement plugin wasn't around until RRF3.3
-
@kuon no, dsf-config.g is automatically called by DCS and does not require the management plugin. Neither do M550 or M551. In order to apply it, ESTOP or a service restart is needed.
-
@chrishamm I did restart the service with
systemctl
and it does not applydsf-config.g
. To test it, I have noM550
inconfig.g
andM550 P"Hello"
indsf-config.g
. If I restart the service or emergency stop and then reload the page, the hostname is still used on the top left, and runningM550
returns the hostname as well. (instead ofHello
) -
@kuon I have no good explanation why
dsf-config.g
isn't executed on your system, perhaps a permission thing? Make sure it is present in yoursys
directory (also available as/opt/dsf/sd/sys
on Linux) and that it is readable by thedsf
user/group.When I restart DCS, I can see
Nov 22 18:41:55 Ender3Pro systemd[1]: Stopped Duet Control Server. Nov 22 18:41:55 Ender3Pro systemd[1]: duetcontrolserver.service: Consumed 6.445s CPU time. Nov 22 18:41:55 Ender3Pro systemd[1]: Starting Duet Control Server... Nov 22 18:41:56 Ender3Pro DuetControlServer[1360]: Duet Control Server v3.4.4 Nov 22 18:41:56 Ender3Pro DuetControlServer[1360]: Written by Christian Hammacher for Duet3D Nov 22 18:41:56 Ender3Pro DuetControlServer[1360]: Licensed under the terms of the GNU Public License Version 3 Nov 22 18:41:56 Ender3Pro DuetControlServer[1360]: [info] Settings loaded Nov 22 18:41:56 Ender3Pro DuetControlServer[1360]: [warn] Support for third-party root plugins is enabled Nov 22 18:41:56 Ender3Pro DuetControlServer[1360]: [info] Environment initialized Nov 22 18:41:56 Ender3Pro DuetControlServer[1360]: [info] Connection to Duet established Nov 22 18:41:56 Ender3Pro DuetControlServer[1360]: [info] IPC socket created at /run/dsf/dcs.sock Nov 22 18:41:56 Ender3Pro systemd[1]: Started Duet Control Server. Nov 22 18:41:59 Ender3Pro DuetControlServer[1360]: [info] Starting macro file dsf-config.g on channel SBC Nov 22 18:42:00 Ender3Pro DuetControlServer[1360]: [info] Finished macro file dsf-config.g
which proves it is executed correctly.
Also note that in SBC mode
M550
may be used without the DuetPiManagementPlugin only to decorate the hostname, e.g. to change the caption from "ender3pro" to "Ender 3 Pro" (i.e. to change casing and to add spaces). For system-related changes on Linux, the DuetPiManagementPlugin is mandatory.Since I cannot reproduce any of your problems here, it may actually be a good idea to backup your config, obtain our latest DuetPi or DuetPi Lite image again, and then see if the problems persist once your SBC is up and running again.
-
@chrishamm I did some more testing, and I think I "might" have something.
I realized that prusa slicer is using
GET /rr_connect
but this call returns 404, I have a feeling this is not normal.I tried with
curl 'http://3d.e42.ch/rr_connect?password=1234' -v
and sure enough I get a 404.
Prusa seems to ignore the error and proceed to the rest of the requests (
/machine/status
...), which works if no password is set, but doesn't if it is set.