Marco
Thanks for this. Just for curiosity, did you test it just on Windows, or on other OSs as well. The logic of the Dec 2010 fix was that David Goriseks original, being developed on Dolphin, could not be guaranteed to work except on Windows. I only use Windows, so it is just curiosity. BTW, the author of the Dec 2010 fix, sas, is Sebastian Sastre, so definitely he. Peter Kenny From: Pharo-users <pharo-users-boun...@lists.pharo.org> On Behalf Of Matias Maretto Sent: 25 July 2018 13:34 To: Any question about pharo is welcome <pharo-users@lists.pharo.org> Subject: Re: [Pharo-users] OmniBase for Pharo 6 Marco: thank you for this. A few weeks ago when I was trying to find the "lock" problem I saw this method but I did not dare to change it; and just as you said I been using OminBase with no problem, but never runned the Garbage Collector, Surely I was going to have a bigger problem in the future for not running the garbageCollect. I have just update this method on my project and tried both the garbageCollect and the reorganize method , both worked fine (win 7 32bits, later I am going to test on Win 10 64 bits). Thanks again. Matías. _____ De: Pharo-users <pharo-users-boun...@lists.pharo.org <mailto:pharo-users-boun...@lists.pharo.org> > en nombre de marco <ma...@omeleon.de <mailto:ma...@omeleon.de> > Enviado: miércoles, 25 de julio de 2018 10:23 a. m. Para: pharo-users@lists.pharo.org <mailto:pharo-users@lists.pharo.org> Asunto: Re: [Pharo-users] OmniBase for Pharo 6 One serious problem left: OmniBaseTest>>testGC fails. Have a look at the 2 methods /ODBContainer>>lockDataFile "Dec, 2010 sas: this code was relying in evaluating a block that was happening only in win32 but not in *nix. So now I'm making it wait for the lock and then execute the code normally because it seems the intention was the same." | currentSpace defaultSpace | activeDataFile waitForAddingLock. currentSpace := activeDataFile == dataFileA ifTrue: [0] ifFalse: [1]. defaultSpace := objectManager defaultObjectSpace. currentSpace == defaultSpace ifFalse: [defaultSpace == 0 ifTrue: [dataFileA isNil ifTrue: [dataFileA := ODBObjectStorage openOn: self dataFileNameA]. activeDataFile := dataFileA] ifFalse: [dataFileB isNil ifTrue: [dataFileB := ODBObjectStorage openOn: self dataFileNameB]. activeDataFile := dataFileB]. ^self lockDataFile] ODBFile>>waitForLockAt: pos length: length whileWaitingDo: aBlock "Wait for lock at given position. Evaluate aBlock in each iteration." "Dec, 2010. sas: evaluating code in each iteration while waiting sounds weird but whatever. I think this was designed on the wrong assumption that the OS always will provide a false in the first try but what actually happens is that in win32 you always will get at least one false but in *nixes you don't do see that happening (which is totally reasonable). BEWARE of stupid code relying on this stupid assumption (I've already patched #lockDataFile because of this)." | startTime currentTime | (stream lockAt: pos length: length) ifFalse: [ startTime := Time totalSeconds. [stream lockAt: pos length: length] whileFalse: [ aBlock value. currentTime := Time totalSeconds. currentTime - startTime < self timeOutLength ifFalse: [ ODBLockNotification signal ifTrue: [startTime := currentTime] ifFalse: [^ODBCannotLock signal]]]] / So "sas" did a refactoring in 2010 because he/she thought it is stupid code. This code change breaks the GarbageCollection of Omnibase. I reverted the first method to the original code of the Omnibase author, David Gorisek: /lockDataFile | currentSpace defaultSpace | activeDataFile waitForAddingLockWhileWaitingDo: [currentSpace := activeDataFile == dataFileA ifTrue: [0] ifFalse: [1]. defaultSpace := objectManager defaultObjectSpace. currentSpace == defaultSpace ifFalse: [defaultSpace == 0 ifTrue: [dataFileA isNil ifTrue: [dataFileA := ODBObjectStorage openOn: self dataFileNameA]. activeDataFile := dataFileA] ifFalse: [dataFileB isNil ifTrue: [dataFileB := ODBObjectStorage openOn: self dataFileNameB]. activeDataFile := dataFileB]. ^self lockDataFile]] / I removed the comment of "sas" from the second method. It is wrong. The garbage collection works again and the test is green. GC is an important feature of Omnibase. It creates a new repository/database file and copies the data into the new file, compressing the data. It keeps your database compact and clean. If you don't run it (frequently) your db files keep on growing... Matias, your fixes are absolutely valid and should be published - together with the one above - in Esteban's repository. -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html <http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html> Smalltalk - Pharo Smalltalk Users | Mailing List Archive forum.world.st Pharo Smalltalk Users forum and mailing list archive. Pharo User Forum