Java - Random timeouts due to

Just tried in Code A La Mode.
No timeouts in 10 games with commented err output

but a real simple bot in CultistWars wastes time while calling a method.
err output was just added afterwards to locate the time waster

timestamp before method call and first line in method is 70ms apart …

Couldn’t find the 70ms again
and sometimes id don’t even reach the method call

in this game it is 60ms vanishing

We’ll fallback to Java 8 tomorrow. We’ll continue to investigate so we can finally go back to Java 11 at some point.

8 Likes

Java is still unuseable. Have you done a specific change two weeks ago?

2 Likes

I think they didn’t revert so far, System.getProperty(“java.version”) still reports version=11.0.2

Indeed, we had an other issue preventing us from doing the fallback. We’ll migrate back to Java 8 today.

1 Like

We reverted to Java 8 for all JVM based languages (except for non-Multiplayer Java)

3 Likes

I’m unsure. Solo/CoC puzzles are still in java 11 ?

Back to Java 8 yesturday, no more problem in any game for me !

Let’s un-comment sys errs (⌐■_■)

Yeah! My timeout problems are gone, thank you.

I just resubmitted my Clojure player for Code a la Mode and the timeouts are still occurring. :anguished:

Same for me. My code for “Code à la mode” reached Gold league without issues, then it started to time out a few days before the Legend league opens and it still times out. I didn’t investigate further.

On “Bit Runner 2048”, my code has to reply within 5ms to avoid any timeout (and it is not a guarantee).

it solved my Java timeout on CR for me. NTR.

Please also update the FAQ which still points to java 11.

1 Like

I also doubt there is 768 MB memory available since the JVM is started with the following parameters: [-Xms64m, -Xmx450m, -Xverify:none, -Djava.awt.headless=true, -ea].

I just submitted my solution to “The Labyrinth” written in Clojure and got timeouts on random testcases each time I submitted. Removing all error output solved it for me. Having just a single error output as the first statement brings back the same problem.

1 Like

Thanks for this information. We’ll modify the Clojure stub to add a debug function and an output function which flushes.

@MarvinTheMartian it seems though that the timeouts that you experienced are not linked to that since you used flush in your code

since the JVM is started with the following parameters: [-Xms64m, -Xmx450m,

Do you know for a fact that these are the parameters used? It would be a good idea if we could have the -Xms and -Xmx set to the same values (and why not -Xmx768M?). This will eliminate the JVM having to resize the heap (costly) and should reduce the number of times the GC has to run.

I am not sure if this is the correct place for this, but my problems seem related.

I recently experienced random timeout errors trying to code the MimeType puzzle in Groovy. The puzzle isn’t exactly rocket science so I was surprised at the timeouts. My Java solution worked fine but the exact same code running as Groovy would result in timeouts on about 50% of the runs. For those not familiar with Groovy it is basically a superset of Java and 99% of valid Java code is also valid Groovy code. So I could use my Java solution as-is and run it as Groovy.

I did some instrumenting using the tips above and found the following:

  1. For Groovy code the JIT compiler didn’t settle down until about 1K iterations.
  2. Calls to System.out were the real culprit.

I was able to solve my timeout issue by writing to a buffer (StringBuilder) and then producing all output with a single call to println() rather than calling println() every iteration. Once I submitted a solution that scored 100% I was able able to view the other Groovy solutions and the two l tried exhibited the same time out problems. So something has changed in later versions of Groovy, but I can’t imagine what.

1 Like

Hi @HaywoodSlap, your problem is not related to the java timeouts as your simple groovy code times out always on the MimeType puzzle whereas the Java issue is about a timeout that occurs randomly while submitting in multiplayer games (especially when using java 11 which we rolledback)

Nevertheless this is a quite valid issue that we could reproduce and we’ll investigate.

1 Like

Hi, if there are two java Players, do they run in the same JVM? It seems so from quick code skim.

I know GC can kill my code, that is why I don’t waste a single object - but what if my openen’t doesn’t care?