java.lang.IllegalStateException in VanillaChronicleMap

166 views
Skip to first unread message

Randy Prager

unread,
Apr 10, 2015, 4:20:36 PM4/10/15
to java-ch...@googlegroups.com
We are seeing this exception

java.lang.IllegalStateException
	at net.openhft.chronicle.map.ShortShortMultiMap.nextPos(ShortShortMultiMap.java:227)
	at net.openhft.chronicle.map.VanillaChronicleMap$Segment.acquireWithoutLock(VanillaChronicleMap.java:1746)
	at net.openhft.chronicle.map.VanillaChronicleMap.lookupUsing(VanillaChronicleMap.java:810)
	at net.openhft.chronicle.map.VanillaChronicleMap.acquireUsingLocked(VanillaChronicleMap.java:772)
2015-04-10 14:51:26,729 WARN  [A-selector] net.openhft.chronicle.hash.ChronicleHashErrorListeners$LoggingErrorListener - Grabbing lock held by processId: 134217728, threadId: 0
writersWaiting has underflowed
writersWaiting has underflowed
writersWaiting has underflowed
writersWaiting has underflowed
2015-04-10 14:51:26,730 WARN  [B-selector] net.openhft.chronicle.hash.ChronicleHashErrorListeners$LoggingErrorListener - Grabbing lock held by threadId: 0
2015-04-10 14:51:26,731 WARN  [C-selector] net.openhft.chronicle.hash.ChronicleHashErrorListeners$LoggingErrorListener - Grabbing lock held by threadId: 0
2015-04-10 14:51:26,731 WARN  [D-selector] net.openhft.chronicle.hash.ChronicleHashErrorListeners$LoggingErrorListener - Grabbing lock held by threadId: 0
2015-04-10 14:51:26,730 WARN  [E-selector] net.openhft.chronicle.hash.ChronicleHashErrorListeners$LoggingErrorListener - Grabbing lock held by threadId: 0


Here is the code

 try (WriteContext<SmallCharSequence, LongValue> context = cache.acquireUsingLocked(small, longValue)) {
        longValue.setValue(helper.id);
 } 

Have you seen this before?  

Using 
chronicle-map 2.1.4, 
lang 6.6.2, 
chronicle 3.4.2
collections 3.3.2
compiler 2.2.0

Rob Austin

unread,
Apr 10, 2015, 5:25:11 PM4/10/15
to java-ch...@googlegroups.com
thanks we wil investigate this.

--
You received this message because you are subscribed to the Google Groups "Chronicle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-chronicl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Randy Prager

unread,
Apr 13, 2015, 2:37:28 PM4/13/15
to java-ch...@googlegroups.com
The cause appears to be when the map is sized too small.  

Greg Temchenko

unread,
May 15, 2015, 7:17:00 PM5/15/15
to java-ch...@googlegroups.com
Getting this error too. The stacktrace is different though:

java.lang.IllegalStateException: writersWaiting has underflowed
        at net.openhft.lang.io.AbstractBytes.tryRWWriteLock0(AbstractBytes.java:2770)
        at net.openhft.lang.io.AbstractBytes.tryRWWriteLock(AbstractBytes.java:2735)
        at net.openhft.chronicle.map.VanillaChronicleMap$Segment.readLock(VanillaChronicleMap.java:1572)
        at net.openhft.chronicle.map.VanillaChronicleMap$Segment.containsKey(VanillaChronicleMap.java:2226)
        at net.openhft.chronicle.map.VanillaChronicleMap$Segment.access$000(VanillaChronicleMap.java:1442)
        at net.openhft.chronicle.map.VanillaChronicleMap.containsKey(VanillaChronicleMap.java:908)
        at net.openhft.chronicle.map.VanillaChronicleMap.containsKey(VanillaChronicleMap.java:887)

It happens only under heavy load.
Any explanations on what happens?

Peter Lawrey

unread,
May 15, 2015, 10:29:16 PM5/15/15
to java-ch...@googlegroups.com

When a thread waits a long time (more than 20 seconds) it grabs the lock on the assumption the process holding the lock has died. If the thread has not actually died it detects that it lost the write lock and complains.

We could do a better job of adjusting the time out for systems under extreme loads but I suggest you should avoid overloading the server to this degree.

Randy Prager

unread,
May 16, 2015, 6:57:53 AM5/16/15
to java-ch...@googlegroups.com
I believe we saw a similar exception that we fixed by ensuring all map access occurred inside the ReadContext and WriteContext and only operations that modified the map were done in the WriteContext.

Peter Lawrey

unread,
May 16, 2015, 7:06:07 AM5/16/15
to java-ch...@googlegroups.com

Doing this will improve concurrency. Only use the write context if you really need to.

On 16 May 2015 11:57 am, "Randy Prager" <ra...@fixflyer.com> wrote:
I believe we saw a similar exception that we fixed by ensuring all map access occurred inside the ReadContext and WriteContext and only operations that modified the map were done in the WriteContext.

GorillaCoder

unread,
May 17, 2015, 1:55:21 PM5/17/15
to java-ch...@googlegroups.com
RE: I suggest you should avoid overloading the server to this degree.

We are seeing this during a full gc. We can defer, but there is no way to stop full gcs. What do you recommend we do?

Peter Lawrey

unread,
May 17, 2015, 2:05:25 PM5/17/15
to java-ch...@googlegroups.com

It is possible to have systems without full GC,  but most systems will have them.
I will look at changing the strategy to allow for GC pauses.

Peter Lawrey

unread,
May 18, 2015, 5:19:45 AM5/18/15
to java-ch...@googlegroups.com
We are working on a number of options to improve this.  The first one is being more tolerant of jitter in the system.

Message has been deleted

GorillaCoder

unread,
May 18, 2015, 11:00:25 AM5/18/15
to java-ch...@googlegroups.com
Yeah, it is. I know how to do it, but am working on a system I inherited. There are bigger fish to fry first, but reducing/eliminating full GCs is on the agenda.

In a later reply you mention being more tolerant of jitter. You are probably already aware of this: Gene Tene (of Azul) has a great tool for measuring jitter. Pretty much the right approach, using essentially a log scale, to capture a histogram of jitter durations in a compact memory space. You don't really need the histogram over all time, so a smaller bounded buffer and a hi prio thread to measure the recent jitter should do.

BTW: was half way through my own implementation of a large MemoryBuffer when I found yours (Needed it both for large data sets and to eliminate java's MemoryBuffer's requirement to call System.gc to clean up resources). It's what brought Chronicle to our attention.

It was hard to find both your MemoryBuffer replacement and Chronicle in google searches. You might want to figure out how to bump them up in the rankings. 

Peter Lawrey

unread,
May 18, 2015, 11:31:18 AM5/18/15
to java-ch...@googlegroups.com
Hello GorillaCoder,
   The approach we are taking for systems with long pauses is to count down the timeout.  This will treat jump of 2 or more milliseconds as just one milli-second.  This is useful for not just GC pauses but debugging code, line by line without timeouts getting triggered.

Regards,
   Peter.

--
Reply all
Reply to author
Forward
0 new messages