MacSergey / NodeMarkup

MIT License
61 stars 15 forks source link

Crash on Linux #96

Open damienwojtowicz opened 3 years ago

damienwojtowicz commented 3 years ago

This mod causes crash when saving a map. Backups are not generated properly.

I'm running CS through Steam on Archlinux. I have the last version of all packages, Steam and CS. Only this mod and its dependency Harmony is installed, and activated when running the game. Running the game without any mod, with the --noWorkshop parameter or with other mods but NodeMarkup does not cause this crash.

Here is my Player.log file. tail -n 30 on this yields:

(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

[NodeMarkup] NodeMarkupButton.Start

(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

[NodeMarkup] NodeMarkupButton.Deactivate

(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

GfxDevice: creating device client; threaded=1
GfxDevice: creating device client; threaded=1
Quick save requested  [Core]

(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

[NodeMarkup] Serializer.OnSaveData

(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

[NodeMarkup] Serializer.Compress

(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Receiving unhandled NULL exception
#0  0x007f3b44533f00 in funlockfile
#1  0x007f3b445344b8 in (Unknown)
GfxDevice: creating device client; threaded=1
GfxDevice: creating device client; threaded=1
GfxDevice: creating device client; threaded=1

Given the log, the issue seems to come from function Compress in NodeMarkup/NodeMarkup/Utils/Serializer.cs. I don't know anything in CS modding, but given dependencies in this module (such as System.Xml System.IO.Compression), I believe the issue is linked to my OS configuration.

Let me know if more info are needed.

MacSergey commented 3 years ago

It depends on Linux. I don't know what the problem is, but someone has everything working, and someone has this error

damienwojtowicz commented 3 years ago

Okay, so I found a solution. When I installed Monodevlop in order to debug this, it came with a few dependencies. One of them is called mono, and it turns out having mono installed prevents the crash. It works like a charm now.

Thanks for your reply and your great mod! ^_^

MacSergey commented 3 years ago

@damienwojtowicz This is very interesting, if you don't mind describing it in more detail.

krzychu124 commented 3 years ago

Oh...wait @MacSergey I forgot that I've had mono installed (I was debugging TM:PE)... Maybe that could solve https://github.com/CitiesSkylinesMods/TMPE/issues/817, since I can't reproduce issue myself (probably because of that mono installed)?

damienwojtowicz commented 3 years ago

I installed the package monodevelop-bin, which comes with the following dependencies:

In the end, I ended up with packages gtk-sharp-2, gtk-sharp-3, libgdiplus, libglade and mono installed.

At this point, I ran the game in order to check if I unsubscribed from your mod, but I didn't. Before diving into debuging and C#, I checked if the bug was still there. It was gone. So I checked which packages I installed with Monodevelop, and uninstalled those one by one and ran the game each time in order to identify which package fixed the crash.

In the end, I found that having mono and its dependencies prevents crash. I also just noticed a crash at load time with this mod without mono installed. This time in Serializer.Decompress. I don't have a clean log (all my mods are now loaded X) ), but here are the last lines:

[NodeMarkup] Serializer.OnLoadData

(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

[NodeMarkup] Serializer.Decompress

(Filename: /home/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Receiving unhandled NULL exception
#0  0x007f4420eb4f40 in funlockfile
#1  0x007f4420eb54d8 in (Unknown)

@krzychu124 I had the bug described in your issue. My case is the same as this comment. It is now gone. I had this bug since SH update on an old city, and my workaround was to click on 81 Tiles "Recovery" button before unpausing after save load. I am going to investigate a bit and I come back to you on your issue.

achillefalaise commented 3 years ago

I can confirm the bug seems linked to Mono environment being installed or not. I am on Linux Mint 20, and had the same problem, with the game crashing on save when using the mod. It is was quite a fresh install of Linux, with nothing mono-related installed.

Installing mono-devel (which I believe is more or less the Debian/Ubuntu/Mint equivalent of Arch's monodevelop-bin package) solved the issue for me. It came with a lot of dependencies (like mono-runtime-common); they're probably not all necessary, but it works and that's all I need. I can now save and load games, and everything seems to work fine !

akmijares commented 3 years ago

Hello! I can also verify, that just by having the mono package installed also solved my issue. Just a suggestion, but maybe having a notice in the mod description to have the package installed would probably help a lot of people.

Skippern commented 3 years ago

mono is the standard .NET C# framework, if that solves the crash it might indicate that the plugin uses some features not in default C# framework on Linux and/or game libraries.

Ghoughpteighbteau commented 3 years ago

@damienwojtowicz dang, wish I could let you at my system for a bit. I have the monodevelop-bin package and I'm getting hard crashes when saving, with or without it.

If I could break point debug it I'd at least be able to narrow down some cause... But I have no idea what I'm doing with C# dev... ahhhh hell I might take a crack at it regardless.

edit: I forgot, I flatpakked steam, and that sandboxed it, so the presence of monodevelop didn't matter. Reinstalling steam on my host system instead of through a flatpak and installing monodevelop-bin seems to get it working. Doesn't seem like there's a monodevelop flatpak in existence any more. Oh well.

BongoEADGC6 commented 3 years ago

Receiving unhandled NULL exception

0 0x007f3b44533f00 in funlockfile

1 0x007f3b445344b8 in (Unknown)

Can confirm similar issues with crashing on save with Intersection Marking Tool enabled. OS: Kubuntu 20.04

andreas-hurka commented 3 years ago

I can report similar behavior for opensuse leap 15.2. The package I installed (with a bunch of dependencies) is called monodevelop. As @Ghoughpteighbteau already pointed out this does not work when steam is installed through flatpak. I think you would save some linux users hours of trial and error by pointing out that mono is required for linux users, as the Player.log file from unity3D contains stuff about 32bit libraries and the recommended fix for that is to use the flatpak version of steam. Glad I can now use this amazing tool!

vimishor commented 3 years ago

Same issue here, on Ubuntu 20.04: crash when saving a game. Installing mono-runtime package solved the issue.

vitaliy-tkachuk commented 3 years ago

Same issue in Arch Linux and installing mono also helped. sudo pacman -S mono

NiPfi commented 3 years ago

Exact same thing here. I wasted so much time finding the responsible mod but I'm glad it's one that has a GitHub so the workaround was more readily findable.

tazz4843 commented 3 years ago

Can verify apt install mono-devel fixes this issue on Linux Mint 20.1.

kane-thornwyrd commented 3 years ago

I confirm:

Crash when using:

Work flawlessly when using:

Here a little snippet for you, the lazy person who land here but use an Arch-derived distro with yay: $ yay -Suy steam-native mono monodevelop-bin

Here's a little neofetch, just in case.

❯ neofetch
██████████████████  ████████   kane-thornwyrd@monolith 
██████████████████  ████████   ----------------------- 
██████████████████  ████████   OS: Manjaro Linux x86_64 
██████████████████  ████████   Kernel: 5.11.19-1-MANJARO 
████████            ████████   Uptime: 1 day, 4 hours, 55 mins 
████████  ████████  ████████   Packages: 1774 (pacman), 13 (flatpak) 
████████  ████████  ████████   Shell: bash 5.1.8 
████████  ████████  ████████   Resolution: 1920x1080 
████████  ████████  ████████   DE: Plasma 5.21.5 
████████  ████████  ████████   WM: KWin 
████████  ████████  ████████   WM Theme: Lightly 
████████  ████████  ████████   Theme: Monochrome [Plasma], Breeze [GTK2/3] 
████████  ████████  ████████   Icons: Fluent-dark [Plasma], Fluent-dark [GTK2/3] 
████████  ████████  ████████   Terminal: konsole 
                               Terminal Font: Noto Mono 10 
                               CPU: AMD Ryzen 3 3300X (8) @ 3.800GHz 
                               GPU: AMD ATI Radeon RX 5600 OEM/5600 XT / 5700/5700 XT 
                               Memory: 11952MiB / 32039MiB                                                        
m3nowak commented 3 years ago

Fedora 34 on KDE, I can confirm as well that installing mono fixes this problem.

brandonscript commented 3 years ago

Can anyone verify that this is causing crashes on MacOS as well? It's happening to me quite frequently, though even after installing mono, it hasn't fixed it. I can't find any logs to explain what's going on, so I can't determine if the problem is related to this issue or not.

IvanLuchkin commented 3 years ago

I'm using KDE Neon (ubuntu-based), Mono is installed, though I've installed it after installing the game. Still crashes

cdombroski commented 3 years ago

Debian bullseye: installing mono-runtime was sufficient to prevent crashes with this mod and your other mods as well (NCR and BSP)

samtoxie commented 2 years ago

Could be this is related to what was happening in TMPE for linux users: https://github.com/CitiesSkylinesMods/TMPE/issues/817

If you tried installing the mono package and it still doesn't work: try adding STEAM_RUNTIME_PREFER_HOST_LIBRARIES=1 %command% as launch option. Steam might be picking up a bundelled version of mono instead of the one on your system.

krzychu124 commented 2 years ago

Could be this is related to what was happening in TMPE for linux users: CitiesSkylinesMods/TMPE#817

If you tried installing the mono package and it still doesn't work: try adding STEAM_RUNTIME_PREFER_HOST_LIBRARIES=1 %command% as launch option. Steam might be picking up a bundelled version of mono instead of the one on your system.

No, TM:PE Linux issue was not caused by missing/wrong mono package 😉

m3nowak commented 2 years ago

Could be this is related to what was happening in TMPE for linux users: CitiesSkylinesMods/TMPE#817

If you tried installing the mono package and it still doesn't work: try adding STEAM_RUNTIME_PREFER_HOST_LIBRARIES=1 %command% as launch option. Steam might be picking up a bundelled version of mono instead of the one on your system.

I don't think so, I was getting to get this error without TMPE mod active.

samtoxie commented 2 years ago

Could be this is related to what was happening in TMPE for linux users: CitiesSkylinesMods/TMPE#817 If you tried installing the mono package and it still doesn't work: try adding STEAM_RUNTIME_PREFER_HOST_LIBRARIES=1 %command% as launch option. Steam might be picking up a bundelled version of mono instead of the one on your system.

No, TM:PE Linux issue was not caused by missing/wrong mono package wink

From what I remeber though, a workaround there was also installing mono. I only noticed this mod had it when I got my new PC up and running and I no longer had the workaround I originally put in for TMPE.

In the TMPE error I always had the same stacktrace with the funlockfile null exception.

The issue in TMPE had to do with patching right? It could be possible something similar is happening here.

I've never been into CS modding myself (more of a GTA guy in terms of modding), so it is a bit hard for me to imagine how it all works under the hood. But i'll try and see if I can find something by comparing the mergerequest from TMPE with whats going on here.

samtoxie commented 2 years ago

Could be this is related to what was happening in TMPE for linux users: CitiesSkylinesMods/TMPE#817 If you tried installing the mono package and it still doesn't work: try adding STEAM_RUNTIME_PREFER_HOST_LIBRARIES=1 %command% as launch option. Steam might be picking up a bundelled version of mono instead of the one on your system.

I don't think so, I was getting to get this error without TMPE mod active.

I don't mean having both could cause the error, I mean that the error in this mod looks similar to an error that used to be present (but got fixed) in TMPE.

Cottand commented 1 year ago

@MacSergey I am playing CS on the Steam Deck without wine (so linux, but inside the Linux Runtime Environment) which means installing mono does not help. After reading https://github.com/CitiesSkylinesMods/TMPE/issues/1502#issuecomment-1142693970, it seems to me that this is due to you using Gzip here specifically.

I have no experience with C# or .NET in general, so I could not figure out how TMPE perform compression on my own, but from the comment I linked above it seems they found a utility budled with CS. Is there a chance you can take the same approach to remove the dependency on mono for this mod? This also applies to Node Controller since it uses the same lib.

I don't know how big the saves get, but perhaps an option to disable compression entirely could be a different fix? Currently no Steam Deck user running CS on linux can run any of your mods because of this.

krzychu124 commented 1 year ago

TMPE does not use any compression yet that's why it works. MacSergey is also using CS utility afaik.

Cottand commented 1 year ago

Is using compression a requirement or do you think an option to disable it (some sort of 'compatibility mode') is possible?

krzychu124 commented 1 year ago

I have no idea how much data IMT needs to store so I can't answer on that question.

Cottand commented 1 year ago

I would like to disable compression to be able to use this mod. I have very limited Unity/C# knowledge, so I think my options are

I am happy to go with (1) on my own, but this would not fix it for anybody else, so I would prefer (2). The same could be done to Node Controller Renewal which has the same problem.

StefanBruens commented 1 year ago

This seems to be a bug in Proton, as proton includes all the required assemblies (i.e. it bundles a complete mono).

Maybe someone owning a Steam Deck should complain to Valve.

artur6768 commented 6 months ago

Is there a way to fix this error using flatpak steam?

jmaris commented 4 months ago

Is there a way to fix this error using flatpak steam?

Flatpak users could try installing org.freedesktop.Sdk.Extension.mono6 for the Flatpak SDK that Steam is using. Testing now EDIT: Tried this, unfortunately to no avail