[Ohrrpgce] [ohrrpgce:bugs] #2035 Missing/corrupt data in-game while using Test Game

TeeEmCee teeemcee at users.sourceforge.net
Thu Aug 30 07:23:16 PDT 2018


I've discovered that the file locking done on Windows doesn't actually prevent Game from seeing a file in the middle of being written. If a file is opened ACCESS WRITE (aka ACCESS_WRITE), whether using the locking I implemented in OPENFILE, or FB's builtin locking if OPEN is used with LOCK, the file is first opened for write, which truncates it to length zero, and *then* is locked. And it turns out it's actually really common to hit the file at that exact moment if both Game and Custom are opening it often.

I should be able to make OPENFILE work around this problem.

However ACCESS WRITE is only used in 16 places, and shop and item data aren't among them.


---

** [bugs:#2035] Missing/corrupt data in-game while using Test Game**

**Status:** open
**Milestone:** OHRRPGCE
**Labels:** test game shops 
**Created:** Tue Aug 28, 2018 09:06 AM UTC by TeeEmCee
**Last Updated:** Tue Aug 28, 2018 10:27 AM UTC
**Owner:** nobody


Wobbler reported once:
> ...while testing my game, I went into a shop to sell some items and every option was blank. It still showed the correct sell price and I could sell stuff, but I couldn't see any of the item names. I closed the game, opened it again, and everything was back to normal

SwordPlay also said he'd seen something like it, but couldn't remember anything at all.

While Custom is writing a lump it locks it to ensure that Game doesn't simultaneously try to read it. However, our load/save code often opens and closes a file multiple times, or writes multiple files, and there's no synchronisation around such operations to prevent Game from seeing inconsistent state. So I think there are a lots of weird things you might see if you get very unlucky.

In the case of item names note we don't cache those, and instead open .ITM to read the name of each item in a shop. But the names of the things in a shop are taken from STF, not ITM. The real item names are used on the right-hand-side info pane. The STF records for a shop are read/written all at once, so I don't know how what Wobbler saw could happen.

This bug report isn't specifically about shops though.


---

Sent from sourceforge.net because ohrrpgce at lists.motherhamster.org is subscribed to https://sourceforge.net/p/ohrrpgce/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/ohrrpgce/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20180830/61ad21a8/attachment-0001.html>


More information about the Ohrrpgce mailing list