MantisBT - VCMI
View Issue Details
0000994VCMIOtherpublic2012-06-07 16:552014-05-30 17:41
Risto 
Tow 
normalcrashrandom
closedfixed 
LinuxLubuntu12.04
0.89 
0.9 
0000994: Failed to rewrite autosave.
If you try to rewrite the previously created autosave, the game crashes. The pattern could not be traced, but a failure occurs on a regular basis, at the time of the next autosave.

The error message:

Error: cannot open to write / home/risto/.vcmi/Games/Autosave_3.vcgm1
Connection has been requested to be closed.
Sent closing signal to the server
zsh: segmentation fault vcmiclient
No tags attached.
has duplicate 0000995closed Ivan The names of the sprites and data files in any given case. 
Issue History
2012-06-07 16:55RistoNew Issue
2012-06-07 20:56RistoNote Added: 0002627
2012-06-08 00:19TowNote Added: 0002633
2012-06-08 09:50RistoNote Added: 0002634
2012-06-08 11:01RistoNote Added: 0002635
2012-06-08 11:02RistoNote Edited: 0002635bug_revision_view_page.php?rev_id=1698
2012-06-08 11:02RistoNote Edited: 0002635bug_revision_view_page.php?rev_id=1699
2012-06-08 11:28RistoNote Edited: 0002635bug_revision_view_page.php?rev_id=1700
2012-06-08 11:29RistoNote Deleted: 0002634
2012-06-08 13:47RistoNote Added: 0002636
2012-06-08 13:48RistoNote Deleted: 0002635
2012-06-08 13:50RistoNote Edited: 0002636bug_revision_view_page.php?bugnote_id=2636#r1704
2012-06-08 18:07RistoNote Added: 0002637
2012-06-09 22:30TowNote Added: 0002646
2012-06-09 22:30TowAssigned To => Tow
2012-06-09 22:30TowStatusnew => feedback
2012-06-09 22:32TowNote Edited: 0002646bug_revision_view_page.php?bugnote_id=2646#r1707
2012-06-10 11:11RistoNote Added: 0002649
2012-06-10 11:11RistoStatusfeedback => assigned
2012-06-11 09:12IvanNote Added: 0002652
2012-06-11 09:56IvanRelationship addedhas duplicate 0000995
2012-08-08 07:35IvanNote Added: 0002853
2012-08-08 07:35IvanStatusassigned => resolved
2012-08-08 07:35IvanFixed in Version => 0.9
2012-08-08 07:35IvanResolutionopen => fixed
2014-05-30 17:41beegeeStatusresolved => closed

Notes
(0002627)
Risto   
2012-06-07 20:56   
Alternative error message:

Error: cannot open to write /home/risto/.vcmi/Games/Autosave_6.vcgm1
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
vcmiclient: ../../src/xcb_io.c:273: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.

Check the availability of file and access permissions:

ls -l /home/risto/.vcmi/Games/Autosave_6.vcgm1
-rw-rw-r-- 1 risto risto 95 июня 7 12:32 /home/risto/.vcmi/Games/Autosave_6.vcgm1
(0002633)
Tow   
2012-06-08 00:19   
Is there any chance that these are savegames from an older build of VCMI?
I just fixed a possible leak, that could cause such error on overwriting old format saves.


Nevertheless I think VCMI should not crash when unable to write a savefile, so the bug is valid either way.
(0002636)
Risto   
2012-06-08 13:47   
(edited on: 2012-06-08 13:50)
I compiled the game from source trunk-branch less than a week ago, and the day before reinstalling it from the deb-package with the wiki pages Installation for Linux. Both times the version of the package was determined as 0.89 for architecture i386. Differ only in the distribution of Linux (in a package wiki - Precise, a hand-built - unstable), but this information is intended for the repository, and should not affect the operation of the program. The package has been replaced in the system, so the package can not be a conflict.

An error is localized. Reproduction:
* I deleted all the files and the autosave started a campaign to pass again.
* The game lasted for 25 moves. During this time, were created and several times successfully overwritten the new AutoSave files.
* There was a failure due to bug 0000995:

Error in file reading: /usr/local/share/vcmi/Sprites/PORTRAITSSMALL
zsh: segmentation fault vcmiclient

* I renamed the required file because it is the only way to get around the bug mentioned:

sudo mv /usr/local/share/vcmi/Sprites/PortraitsSmall.json /usr/local/share/vcmi/Sprites/PORTRAITSSMALL

* After the restart the client and load the last autosave, the game has failed, at the beginning of the next turn the player:

Warning: Cannot open /usr/local/share/vcmi/Mp3/GRASS.MP3: Couldn't read from '/usr/local/share/vcmi/Mp3/GRASS.MP3'
Error: cannot open to write /home/risto/.vcmi/Games/Autosave_2.vcgm1
zsh: segmentation fault vcmiclient

Again, I deleted all the autosave, successfully played about twenty turns, and tried to load the last autosave. An error is also repeated when trying to overwrite the autosave, which is loaded with the game in the fifth turn, after loading the autosave. This is probably the two particular cases:
* An attempt to overwrite the file that was created before rename one of the sprites and data files.
* An attempt to overwrite a file that is loaded with game.

(0002637)
Risto   
2012-06-08 18:07   
The third time the AutoSave files deleted. On the 18th move back there was an error AutoSave:

Error: cannot open to write / home/risto/.vcmi/Games/Autosave_1.vcgm1
zsh: segmentation fault vcmiclient

I tried to download the latest auto-save. At the beginning of the next turn the player back an error:

Error: cannot open to write / home/risto/.vcmi/Games/Autosave_2.vcgm1
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
vcmiclient: .. /.. / src / xcb_io.c: 273: poll_for_event: Assertion `! xcb_xlib_threads_sequence_lost 'failed.
zsh: abort vcmiclient

If in the previous cases it was possible to see the pattern, then I do not find it.
(0002646)
Tow   
2012-06-09 22:30   
(edited on: 2012-06-09 22:32)
In r2750 I committed changes that should stop VCMI from crashing when writing a savegame fails. But it should not fail, so I don't consider this issue to be fixed.

From what you wrote, I understand that everything worked fine, till the crash 0000995 occurred. Then you loaded latest autosave and VCMI wasn't able to overwrite it. Apparently another process keeps it open. I see two possible reasons:
a) VCMI doesn't correctly close file handles after load. However I don't see, how is this possible (and why it works for me then).
b) Even though VCMI crashed, some dependant process remains unkilled in background and keeps the file open for itself.

Please try:
a) Load any saved game. Enter options, then Save Game menu. Try saving the game overwriting the file you just have loaded. Does it fail?
b) After encountering this crash, try checking, which processes use the file. I don't run linux, but google says that "lsof [filename]" does the job.

Thank you for your feedback!

(0002649)
Risto   
2012-06-10 11:11   
This error has ceased to appear yesterday, as well as bug 0000995, after removing the previously added, but not used me 6500 cards in the folder, /usr/local/share/vcmi/Maps Could this be bug caching, the processing of large volumes data?
(0002652)
Ivan   
2012-06-11 09:12   
That would explain read error - at least on Linux there is a limit on how many open files process may have.
I suppose that this should be fixed already in rev 2746 or at least I don't see huge amount of open files right now.

There is another similar bug however - it seems that music handler is not closing files correctly. I'll see what I can do.
(0002853)
Ivan   
2012-08-08 07:35   
Looks to be resolved