After ScriptLoader loadOBAlpha problems, I'm now playing a bit with strace.
very instructive.

strace build/squeak *.image `pwd`/loadOBAlpha.st > tmp.trace 2>&1

Notice a
    (SourceFiles at: 2) truncate: SmalltalkImage current lastQuitLogPosition.
This is because repeated ScriptLoader loadOBAlpha are quickly spoiling
the change log.

Tracing is really slow, especially with these unbuffered writes
write(6, "^", 1)                        = 1
write(6, "s", 1)                        = 1
write(6, "e", 1)                        = 1
write(6, "l", 1)                        = 1
write(6, "f", 1)                        = 1
I remember Eliot noticed this easy potential speed-up already.

I noticed a bunch of try...catch style of open file at startup.
grep ENOENT ../pharo0.1-10268dev09.04.1/tmp.trace | wc -l
4012
Most are plugin/library search and Freetype related.
But a few search concern icons and wonderland... Some room for more
etoys clean-up here?

On my linux box, I can now confirm the socket problem encountered by
loadOBAlpha is really a (Too many open files) problem.
Some @!*^# code is trying to open more than 1018 change log files
which is a bit too much.
Some file closing happens from time to time but very sparsely.
This happens while loading
Installer wiresong
               project: 'ob';
               install: 'OB-Refactory'.

Consequently, the following instruction fails.
Installer lukas
               project: 'ob';
               install: 'OB-Regex';

You can find tmp.trace at http://ncellier.ifrance.com/Squeak/tmp.trace.gz
26MB gzipped.

-------------------------------------------------------------------------------------------------------
Now it's easier to debug the change log opener in image.
But it's not obvious whether we can reproduce in debugger because of
UI, debugger, GC interactions...
So we gonna use the MessageTally/Notification tricks:

build/squeak *.image `pwd`/TraceOpenFile.st &

Tally results are copied in OpenFileTally.txt.
Highly suspect is #readOnlyCopy...
RemoteString is guilty for not closing the file and relying on some
finalization actions...
And OBDynamicProtocols is abusing of this stuff...

So fixing RemoteString by gently closing the file does fix the linux problem...
build/squeak *.image `pwd`/loadOBAlpha.st &


Now this is a good workaround, but what change introduced the problem ?
there are two solutions:
- either recent versions of OB are creating the problem
- or recent changes in Polling UI/or Process changed finalization order

This should be tested in a 3.10.2 image
 - 11309 tallies, 0 msec.

**Tree**
100.0% {0ms} InstallerMonticello(Installer)>>install:
  100.0% {0ms} InstallerMonticello(Installer)>>install
    100.0% {0ms} InstallerMonticello(Installer)>>installLogging
      100.0% {0ms} InstallerMonticello>>basicInstall
        100.0% {0ms} MCVersionLoader>>load
          100.0% {0ms} MCVersionLoader>>loadWithNameLike:
            94.4% {0ms} MCPackageLoader>>loadWithNameLike:
              |94.4% {0ms} MCPackageLoader>>basicLoad
              |  94.4% {0ms} MCPackageLoader>>tryToLoad:
              |    94.4% {0ms} MCClassDefinition(MCDefinition)>>loadOver:
              |      93.7% {0ms} MCMethodDefinition>>load
              |        93.7% {0ms} Behavior 
class(ClassDescription)>>compile:classified:withStamp:notifying:
              |          93.7% {0ms} Behavior 
class(ClassDescription)>>compile:classified:wi...notifying:logSource:
              |            93.7% {0ms} Behavior 
class(ClassDescription)>>addAndClassifySelecto...nProtocol:notifying:
              |              93.6% {0ms} 
SystemChangeNotifier>>methodAdded:selecto...l:class:requestor:
              |                93.6% {0ms} SystemChangeNotifier>>trigger:
              |                  93.6% {0ms} AddedEvent(AbstractEvent)>>trigger:
              |                    93.6% {0ms} 
SystemEventManager(Object)>>triggerEvent:with:
              |                      93.6% {0ms} 
SystemEventManager(Object)>>triggerEvent:withArguments:
              |                        93.6% {0ms} 
WeakActionSequenceTrappingErrors>>valueWithArguments:
              |                          93.6% {0ms} 
WeakActionSequenceTrappingErrors>>valueWithArgum...startingFrom:
              |                            93.6% {0ms} 
WeakMessageSend>>valueWithArguments:
              |                              93.6% {0ms} OBDynamicProtocols 
class>>addedMethodEvent:
              |                                93.6% {0ms} OBDPUncommented 
class(OBDPFilterAbstract class)>>theMethodNamed:hasBeenAddedIn:
              |                                  93.6% {0ms} 
OBDPUncommented(OBDPFilterAbstract)>>protectedWantsSelector:for:
              |                                    31.2% {0ms} 
OBDPUncommented>>wantsSelector:for:
              |                                      |31.2% {0ms} Behavior 
class(Behavior)>>firstPrecodeCommentFor:
              |                                      |  31.2% {0ms} Behavior 
class(Behavior)>>sourceCodeAt:ifAbsent:
              |                                      |    31.2% {0ms} 
CompiledMethod>>getSourceFor:in:
              |                                      |      31.2% {0ms} 
CompiledMethod>>getSourceFromFile
              |                                      |        31.2% {0ms} 
RemoteString>>text
              |                                      |          31.2% {0ms} 
MultiByteFileStream(StandardFileStream)>>readOnlyCopy
              |                                      |            31.2% {0ms} 
MultiByteFileStream class(StandardFileStream class)>>readOnlyFileNamed:
              |                                      |              31.2% {0ms} 
MultiByteFileStream>>open:forWrite:
              |                                      |                31.2% 
{0ms} MultiByteFileStream(StandardFileStream)>>open:forWrite:
              |                                    31.2% {0ms} 
OBDPLong>>wantsSelector:for:
              |                                      |31.2% {0ms} 
CompiledMethod>>getSource
              |                                      |  31.2% {0ms} 
CompiledMethod>>getSourceFor:in:
              |                                      |    31.2% {0ms} 
CompiledMethod>>getSourceFromFile
              |                                      |      31.2% {0ms} 
RemoteString>>text
              |                                      |        31.2% {0ms} 
MultiByteFileStream(StandardFileStream)>>readOnlyCopy
              |                                      |          31.2% {0ms} 
MultiByteFileStream class(StandardFileStream class)>>readOnlyFileNamed:
              |                                      |            31.2% {0ms} 
MultiByteFileStream>>open:forWrite:
              |                                      |              31.2% {0ms} 
MultiByteFileStream(StandardFileStream)>>open:forWrite:
              |                                    31.2% {0ms} 
OBDPRecentlyModified>>wantsSelector:for:
              |                                      31.2% {0ms} 
OBDPRecentlyModified>>isRecent:
              |                                        31.2% {0ms} 
OBDPRecentlyModified>>timeStampForMethod:
              |                                          31.2% {0ms} 
CompiledMethod>>timeStamp
              |                                            31.2% {0ms} 
MultiByteFileStream(StandardFileStream)>>readOnlyCopy
              |                                              31.2% {0ms} 
MultiByteFileStream class(StandardFileStream class)>>readOnlyFileNamed:
              |                                                31.2% {0ms} 
MultiByteFileStream>>open:forWrite:
              |                                                  31.2% {0ms} 
MultiByteFileStream(StandardFileStream)>>open:forWrite:
            5.6% {0ms} MCPackageLoader>>updatePackage:withSnapshot:
              5.6% {0ms} MCPackage>>snapshot
                5.4% {0ms} MethodReference>>asMethodDefinition
                  5.4% {0ms} MCMethodDefinition class>>forMethodReference:
                    2.7% {0ms} MethodReference>>timeStamp
                      |2.7% {0ms} CompiledMethod>>timeStamp
                      |  2.7% {0ms} 
MultiByteFileStream(StandardFileStream)>>readOnlyCopy
                      |    2.7% {0ms} MultiByteFileStream 
class(StandardFileStream class)>>readOnlyFileNamed:
                      |      2.7% {0ms} MultiByteFileStream>>open:forWrite:
                      |        2.7% {0ms} 
MultiByteFileStream(StandardFileStream)>>open:forWrite:
                    2.7% {0ms} MethodReference>>source
                      2.7% {0ms} Character class(Behavior)>>sourceCodeAt:
                        2.7% {0ms} CompiledMethod>>getSourceFor:in:
                          2.7% {0ms} CompiledMethod>>getSourceFromFile
                            2.7% {0ms} RemoteString>>text
                              2.7% {0ms} 
MultiByteFileStream(StandardFileStream)>>readOnlyCopy
                                2.7% {0ms} MultiByteFileStream 
class(StandardFileStream class)>>readOnlyFileNamed:
                                  2.7% {0ms} MultiByteFileStream>>open:forWrite:
                                    2.7% {0ms} 
MultiByteFileStream(StandardFileStream)>>open:forWrite:

**Leaves**
100.0% {0ms} MultiByteFileStream(StandardFileStream)>>open:forWrite:

Attachment: loadOBAlpha.st
Description: Binary data

Attachment: TraceOpenFile.st
Description: Binary data

'From Pharo0.1 of 16 May 2008 [Latest update: #10293] on 1 May 2009 at 6:33:19 pm'!
"Change Set:		RemoteString_FixFileClose-nice
Date:			1 May 2009
Author:			nice

RemoteString don't close the file they open.
This is no well behaved and put too much pressure on finalization mechanism.

This changeSet correct a few miss-behaved methods."!


!CompiledMethod methodsFor: 'source code management' stamp: 'nice 5/1/2009 18:31'!
sourceClass
	"Get my receiver class (method class) from the preamble of my source.  Return nil if not found."

	^ [| theFile |
		theFile := self sourceFileStream.
		[(Compiler evaluate: (theFile backChunk "blank"; backChunk "preamble")) theClass] ensure: [theFile close]] on: Error do: [nil]! !


!RemoteString methodsFor: 'accessing' stamp: 'nice 5/1/2009 18:25'!
string 
	"Answer the receiver's string if remote files are enabled.
	Use a read only copy to avoid syntax errors when accessed via
	multiple processes."
	
	| theFile |
	(sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) == nil]) ifTrue: [^''].
	theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy.
	^[theFile position: filePositionHi.
	theFile nextChunk] ensure: [theFile close]! !

!RemoteString methodsFor: 'accessing' stamp: 'nice 5/1/2009 18:26'!
text 
	"Answer the receiver's string asText if remote files are enabled.
	Use a read only copy to avoid syntax errors when accessed via
	multiple processes."
	
	| theFile |
	(sourceFileNumber == nil or: [(SourceFiles at: sourceFileNumber) == nil]) ifTrue: [^ nil].
	theFile := (SourceFiles at: sourceFileNumber) readOnlyCopy.
	^[theFile position: filePositionHi.
	theFile position > theFile size ifTrue: [
		self error: 'RemoteString past end of file' ].
	theFile nextChunkText] ensure: [theFile close]! !

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to