The International Simutrans Forum

 

Author Topic: Error and segfault when saving with zstd  (Read 409 times)

0 Members and 1 Guest are viewing this topic.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 594
  • Languages: EN
Error and segfault when saving with zstd
« on: January 13, 2021, 08:59:39 AM »
Steps to reproduce:
1. use latest nightly build on ubuntu 20.10 (likely irrelevant)
2. save any game
3. get the following error:
Code: [Select]
ERROR: zstd_file_rdwr_stream_t::zstd_file_rdwr_stream_t: Cannot set wrokers: Unsupported parameter
For help with this error or to file a bug report please see the Simutrans forum:
http://forum.simutrans.com
ERROR: loadsave_t::wr_open: Cannot open 'save/segfault.sv_' for writing!
For help with this error or to file a bug report please see the Simutrans forum:
http://forum.simutrans.com
ERROR: karte_t::save(): cannot open file for writing! check permissions!
For help with this error or to file a bug report please see the Simutrans forum:
http://forum.simutrans.com
Segmentation fault (core dumped)

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20648
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Error and segfault when saving with zstd
« Reply #1 on: January 13, 2021, 09:28:23 AM »
This is very likely to be related to Ceeac's latest patch relating to IO streams, which I believe was an attempt to fix the freezing issue. I do not believe that I have the expertise to fix this without a truly extreme amount of work that I am unlikely to have the time to undertake for the foreseeable future.

Unless a fix can be found for this very soon, I will have to revert the IO streams patch.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 594
  • Languages: EN
Re: Error and segfault when saving with zstd
« Reply #2 on: January 13, 2021, 09:38:55 AM »
This is very likely to be related to Ceeac's latest patch relating to IO streams, which I believe was an attempt to fix the freezing issue. I do not believe that I have the expertise to fix this without a truly extreme amount of work that I am unlikely to have the time to undertake for the foreseeable future.

Unless a fix can be found for this very soon, I will have to revert the IO streams patch.
It's certain, not very likely. The patch will have to be reverted until ceeac is is able to resolve the issue and the patch is tested.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 594
  • Languages: EN
Re: Error and segfault when saving with zstd
« Reply #3 on: January 13, 2021, 09:50:00 AM »
Unfortunately, the fix to this appears to have caused this issue in which all Linux clients crash on attempting to save any game using zstd. I am afraid that I will need to revert this patch unless a solution can be found, and I do not have the expertise in this area of the code (nor the time to acquire such expertise) to do this myself.
I should note that this affects the bridgewater-brunel headless server, in addition to linux clients.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20648
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Error and segfault when saving with zstd
« Reply #4 on: January 13, 2021, 09:50:51 AM »
I should note that this affects the bridgewater-brunel headless server, in addition to linux clients.

Yes, I have noted this checking from the command line interface that the server appears to restart immediately on a force-sync command being issued.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20648
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Error and segfault when saving with zstd
« Reply #5 on: January 13, 2021, 06:48:40 PM »
I have reverted the zstd streams patch for the present, as there does not seem to be a solution to that which I can deduce or implement within any reasonable amount of time. I am running a manual rebuild on the server now, so it should be running again in circa 30 minutes.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10439
  • Languages: De,EN,JP
Re: Error and segfault when saving with zstd
« Reply #6 on: January 14, 2021, 02:45:18 AM »
Ubuntu using version 1.3.8 of zstd. Revision r9567 has a file that should take care of the ZSTD library revision and does not use the new features if too old. You can just copy the file from \io\rdwr\zstd_file_rdwr_stream.cc

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20648
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Error and segfault when saving with zstd
« Reply #7 on: January 14, 2021, 10:53:02 PM »
Thank you for that - that is very helpful. I will have to look into this when I get a moment.

Offline ceeac

  • Devotee
  • *
  • Posts: 219
Re: Error and segfault when saving with zstd
« Reply #8 on: Yesterday at 05:07:16 PM »
I have submitted pull request #342 which includes prissi's changes. Please test before merging; the other pull request did work for me too.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20648
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Error and segfault when saving with zstd
« Reply #9 on: Yesterday at 11:30:05 PM »
I have submitted pull request #342 which includes prissi's changes. Please test before merging; the other pull request did work for me too.

Thank you very much for this: this is much appreciated. I have now incorporated this. We will have to see whether this works on Ubuntu 20.04 with to-morrow's nightly build.

I notice that this solves another problem, too: previously, for some reason, Simutrans had not been closing the server13353-network.sve file, with the result that this could not be deleted or overwritten. I believe that this was the cause of this error. I only realised that this may have been the cause earlier this evening when trying to delete this file manually and being informed by Windows Explorer that the file was locked by Simutrans-Extended.

If this fix works on the server, too, this should also fix the side-effect of my workaround for this, which is that the players' passwords were automatically reset every evening.

Offline Matthew

  • *
  • Posts: 511
    • Japan Railway Journal
  • Languages: EN, some ZH, DE & SQ
Re: Error and segfault when saving with zstd
« Reply #10 on: Today at 08:58:30 AM »
As of today (#d25652d), I noticed a message appearing in the server log that I don't remember seeing before:

Code: [Select]
Warning: zstd_file_rdwr_stream_t::zstd_file_rdwr_stream_t:      Cannot set workers: Unsupported parameter
It might be correlated with players failing to join, but the log is messy with players joining and failing to join, so I'm very uncertain about that.

This may be the wrong thread but seemed to be the most likely candidate.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10439
  • Languages: De,EN,JP
Re: Error and segfault when saving with zstd
« Reply #11 on: Today at 12:37:27 PM »
This should no longer occur with the patch, if included correctlz, since this would be only called when the librarz is new enough to understand this parameter.