lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doron Cohen (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3746) suggest.fst.Sort.BufferSize should not automatically fail just because of freeMemory()
Date Mon, 06 Feb 2012 06:33:59 GMT


Doron Cohen commented on LUCENE-3746:

Thanks Dawid! 

it's probably a system daemon thread for sending memory threshold notifications

Yes this makes sense. 
Still the difference between the two JDKs felt bothering.
Some more digging, and now I think it is clear. 

Here are the stack traces reported (at the end of the test) with Oracle:
1.  Thread[ReaderThread,5,main]
2.  Thread[main,5,main]
3.  Thread[Reference Handler,10,system]
4.  Thread[Signal Dispatcher,9,system]
5.  Thread[Finalizer,8,system]
6.  Thread[Attach Listener,5,system]

And with IBM JDK:
1.  Thread[Attach API wait loop,10,main]
2.  Thread[Finalizer thread,5,system]
3.  Thread[JIT Compilation Thread,10,system]
4.  Thread[main,5,main]
5.  Thread[Gc Slave Thread,5,system]
6.  Thread[ReaderThread,5,main]
7.  Thread[Signal Dispatcher,5,main]
8.  Thread[MemoryPoolMXBean notification dispatcher,6,main]

The 8th thread is the one that started only after accessing the memory management layer. The
thing is, that in the IBM JDK that thread is created in the ThreadGroup "main", while in the
Oracle JDK it is created under "system". To me the latter makes more sense. 

To be more sure I added a fake memory notification listener and check the thread in which
notification happens: 
MemoryMXBean mmxb = ManagementFactory.getMemoryMXBean();
NotificationListener listener = new NotificationListener() {
  public void handleNotification(Notification notification, Object handback) {
((NotificationEmitter) mmxb).addNotificationListener(listener, null, null);

Evidently in IBM JDK the notification is in "main" group thread (also in line with the thread-group
in the original warning message which triggered this threads discussion):
Thread[MemoryPoolMXBean notification dispatcher,6,main]

While in Oracle JDK notification is in "system" group thread:
Thread[Low Memory Detector,9,system]

This also explains why the warning is reported only for IBM JDK: because the threads check
in LTC only account for the threads in the same thread-group as the one running the specific
test case. So when dispatching happens in a "system" group thread it is not sensed by that
check at all.

Ok now with mystery solved I can commit the simpler code...
> suggest.fst.Sort.BufferSize should not automatically fail just because of freeMemory()
> --------------------------------------------------------------------------------------
>                 Key: LUCENE-3746
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: modules/spellchecker
>            Reporter: Doron Cohen
>             Fix For: 3.6, 4.0
>         Attachments: LUCENE-3746.patch, LUCENE-3746.patch, LUCENE-3746.patch
> Follow up op dev thread: [FSTCompletionTest failure "At least 0.5MB RAM buffer is needed"

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message