Closed shimastripe closed 6 years ago
Thank you for your kind bug report in detail. Although I could not reproduce the bug on my environment (Windows), it is likely caused by a recursive call path: LogWriter.getObjectId -> ObjectIdFile.newObjectId -> TypeIdMap.getTypeIdString -> TypeIdMap.createTypeRecord -> Classloader's getResource -> (injected logging code) -> LogWriter.getObjectId.
I will change selogger to avoid the recursive call itself. I think you can temporarily avoid the problem in case of jEdit by changing ObjectIdFile.newObjectId as follows:
protected void onNewObject(Object o, long id) {
String typeId = typeToId.getTypeIdString(o.getClass());
objectIdList.write(Long.toString(id));
objectIdList.write(",");
objectIdList.write(typeId);
objectIdList.write(lineSeparator);
Thank you for providing a workaround. Unfortunately, it resulted in producing the non-sequencial object IDs as follows. (See around the corrupted IDs of 356 and 357)
24120,10
24121,10
24122,10
24116,356
24123,10
24124,24
24125,10
24126,172
24127,10
24128,10
24129,10
24130,279
24131,282
24132,256
24133,10
24134,24
24135,10
24136,24
24138,10
24139,279
24140,22
24141,10
24142,22
24143,10
24144,10
24145,76
24137,357
24146,10
So the assertion (objId == count) still failed at ObjectTypeMap#register (line 52).
(Anyway,) I'm now using selogger on Ubuntu instead of macOS, so I'm not much in a hurry on this issue. Thank you!
I could replicate the problem on Windows by installing a jEdit plug-in using the Plug-in menu of jEdit. The cause is a custom class loader's getResource method used by TypeIdMap. The method generated a new object ID during generation of a type id. The new version firstly generates a new type id, and then generates a new object ID in order to keep the sequential order of id generation.
I also fixed the same problem in the latest version of develop branch. Thank you for the bug report!
I confirmed the LOG$ObjectTypes01.txt is no longer corrupted in the latest version [0c95166] of selogger! Thank you for your swift action. 🙇
Environment
selogger version: 14 May 2015 [9bf6fb1 @ master brunch] target Java Application: jEdit (http://jedit.org/) version:5.3.0
I run the selogger on the following two OSs.
macOS:
Linux:
Problem
On the macOS, I attemped to read execution traces with EventReader, but an assertion (objId == count) failed in ObjectTypeMap#register (line 52). I found some lines in LOG$ObjectTypes01.txt were corrupted.
On Ubuntu, I succeeded in reading the execution traces without the above error, and I confirmed LOG$ObjectTypes01.txt was not broken. The types of the corrupted IDs (356 and 357) are as follows (extracted from LOG$Types.txt):
Here, I provide some debug information I found. https://github.com/takashi-ishio/selogger/blob/0df862637705017a088cb78cd5b4866ebbffe49d/trunk/src/selogger/logging/TypeIdMap.java#L45-L63
I commented out the line 56, and ran the woven application again. Then, the assertion error did not arise and I confirmed the LOG$ObjectTypes01.txt were not corrupted. TypeIdMap#getClassLoacation(), which is invoked at line 56, calls some ClassLoader methods.
So I think there might be a problem with logging a class loader. Actually, macosx.MacOSXPlugin was loaded by a custom class loader (org.gjt.sp.jedit.JARClassLoader) and the custom class loader was instrumented for logging.
How to reproduce the assertion error
weaving option
trace option