KSP-CKAN / CKAN

The Comprehensive Kerbal Archive Network
https://forum.kerbalspaceprogram.com/index.php?/topic/197082-*
Other
1.96k stars 349 forks source link

Download fails and crashes ckan with FATAL UNHANDLED EXCEPTION (Mono.Unix.UnixIOException: Resource temporarily unavailable [EWOULDBLOCK]) #3555

Closed mwerle closed 2 years ago

mwerle commented 2 years ago

Crash occurs while trying to update "Restock" mod. Other mods were able to be updated.

ckan v1.30.4; Debian GNU/Linux 11

Have now tried several times, including moving the download cache from my home directory (local disk) to a network share. Every time close to the end of the download I get this exception.

See attached exception log (please note that the first exception in this log is immaterial; crash also happens when not attempting to update DistantObject mod).

ckan_crash.txt

[ERROR] FATAL UNHANDLED EXCEPTION: Mono.Unix.UnixIOException: Resource temporarily unavailable [EWOULDBLOCK].
  at Mono.Unix.UnixMarshal.ThrowExceptionForLastError () [0x00005] in <b239aefa15154eb595f94b279272ec9d>:0 
  at Mono.Unix.UnixStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00055] in <b239aefa15154eb595f94b279272ec9d>:0 
  at System.Windows.Forms.XplatUIX11.WakeupMain () [0x00000] in <6d635ac3dc1c4424ad385ded79f1e868>:0 
  at System.Windows.Forms.XplatUIX11.SendAsyncMethod (System.Windows.Forms.AsyncMethodData method) [0x00080] in <6d635ac3dc1c4424ad385ded79f1e868>:0 
  at System.Windows.Forms.XplatUI.SendAsyncMethod (System.Windows.Forms.AsyncMethodData data) [0x00000] in <6d635ac3dc1c4424ad385ded79f1e868>:0 
  at System.Windows.Forms.Control.BeginInvokeInternal (System.Delegate method, System.Object[] args, System.Windows.Forms.Control control) [0x0003f] in <6d635ac3dc1c4424ad385ded79f1e868>:0 
  at System.Windows.Forms.Control.Invoke (System.Delegate method, System.Object[] args) [0x00017] in <6d635ac3dc1c4424ad385ded79f1e868>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.Invoke(System.Delegate,object[])
  at System.Windows.Forms.Control.Invoke (System.Delegate method) [0x0001d] in <6d635ac3dc1c4424ad385ded79f1e868>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.Invoke(System.Delegate)
  at CKAN.Util.Invoke[T] (T obj, System.Action action) [0x0000d] in <933dc9d8b62a44ff9a8f866e3767654d>:0 
  at CKAN.Wait.SetDescription (System.String message) [0x00014] in <933dc9d8b62a44ff9a8f866e3767654d>:0 
  at (wrapper remoting-invoke-with-check) CKAN.Wait.SetDescription(string)
  at CKAN.GUIUser.RaiseProgress (System.String message, System.Int32 percent) [0x00017] in <933dc9d8b62a44ff9a8f866e3767654d>:0 
  at CKAN.NetAsyncDownloader.FileProgressReport (System.Int32 index, System.Int32 percent, System.Int64 bytesDownloaded, System.Int64 bytesToDownload) [0x0019e] in <933dc9d8b62a44ff9a8f866e3767654d>:0 
  at CKAN.NetAsyncDownloader+<>c__DisplayClass16_0.<DownloadModule>b__0 (System.Object sender, System.Net.DownloadProgressChangedEventArgs args) [0x0001e] in <933dc9d8b62a44ff9a8f866e3767654d>:0 
  at CKAN.NetAsyncDownloader+NetAsyncDownloaderDownloadPart.<ResetAgent>b__20_0 (System.Object sender, System.Net.DownloadProgressChangedEventArgs args) [0x00008] in <933dc9d8b62a44ff9a8f866e3767654d>:0 
  at System.Net.WebClient.OnDownloadProgressChanged (System.Net.DownloadProgressChangedEventArgs e) [0x0000a] in <9c6e2cb7ddd8473fa420642ddcf7ce48>:0 
  at System.Net.WebClient.<StartAsyncOperation>b__78_9 (System.Object arg) [0x00000] in <9c6e2cb7ddd8473fa420642ddcf7ce48>:0 
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00007] in <533173d24dae460899d2b10975534bb0>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <533173d24dae460899d2b10975534bb0>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <533173d24dae460899d2b10975534bb0>:0 
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <533173d24dae460899d2b10975534bb0>:0 
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <533173d24dae460899d2b10975534bb0>:0 
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <533173d24dae460899d2b10975534bb0>:0 
HebaruSan commented 2 years ago

The crash happens inside non-CKAN code and isn't happening for anyone else, so it's likely to be something with your Mono install. What version of Mono do you have?

DasSkelett commented 2 years ago

Sounds like another case of #3343, did Debian update its Mono package?

HebaruSan commented 2 years ago

They still haven't merged or even commented on mono/mono#21136 ??

DasSkelett commented 2 years ago

Yeah Mono is pretty dead now, even more dead than it has been a few years ago already. I think Microsoft moved all the personnel away and to .NET (5, 6, ...).

HebaruSan commented 2 years ago

@mwerle, there's a test build here that may/should fix the problem you're having:

https://github.com/KSP-CKAN/CKAN/suites/5956890834/artifacts/204524375

mwerle commented 2 years ago

Thanks for the super-fast and detailed investigation. Apologies for the lack of responses last night - I was out having a few beers ;) - as well as my lack of more detailed searching for related issues (I only searched for EWOULDBLOCK).

I had worked around the issue by downloading the mod manually and importing it into CKAN.

Further information (just for interest):


Using the updated test build of ckan (1.30.5) I was unable to reproduce the crash even when attempting to download multiple mods or much bigger mods (Parallax - 1.8GiB). So it seems your changes are a valid workaround. Thank you!