morinted/schedule-generator

Server hang in `CourseSelection.overlaps` function

OttUDad opened this issue · 2 comments

Hi
Looks like there are no servers available ... the UI displays a trying to load and then terminates the program.

Apparently the server got stuck in this loop in CourseSelection.java and crashed — will try to reproduce and resolve this and keep the issue open until then. Meanwhile I'll just tell the server to manually restart about once a day.

public boolean overlaps(CourseSelection e) {
	boolean overlaps = false;
	for (Activity a : getActivities()) {
		for (Activity b : e.getActivities()) {
			if (a.overlaps(b)) {
				overlaps = true;
			}
		}
	}

Error dump when manually stopped:

2018-05-24 17:38:42
Full thread dump OpenJDK 64-Bit Server VM (25.162-b12 mixed mode):

"SIGHUP handler" #78 daemon prio=9 os_prio=15 tid=0x00000008d5a20000 nid=0x189af runnable [0x00007fffde7e5000]
   java.lang.Thread.State: RUNNABLE
	at java.lang.Terminator$1.handle(Terminator.java:52)
	at sun.misc.Signal$1.run(Signal.java:212)
	at java.lang.Thread.run(Thread.java:748)

"Thread-67" #77 prio=5 os_prio=15 tid=0x00000008d542a000 nid=0x18b27 waiting on condition [0x00007fffde1df000]
   java.lang.Thread.State: RUNNABLE
	at java.util.ArrayList.iterator(ArrayList.java:840)
	at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.java:1039)
	at java.util.Collections$UnmodifiableCollection.iterator(Collections.java:1038)
	at ca.uottawa.schedule.CourseSelection.overlaps(CourseSelection.java:174)
	at ca.uottawa.schedule.Schedule.collidesWith(Schedule.java:650)
	at ca.uottawa.schedule.Schedule.generateSchedules(Schedule.java:633)
	at ca.uottawa.schedule.Schedule.generateSchedules(Schedule.java:616)
	at ca.uottawa.ui.GenerateTask.generateSchedules(GenerateTask.java:46)
	at ca.uottawa.ui.GenerateTask.run(GenerateTask.java:25)
	at ca.uottawa.ui.ScheduleGeneratorServer.handleMessageFromClient(ScheduleGeneratorServer.java:165)
	at com.lloseng.ocsf.server.AbstractServer.receiveMessageFromClient(AbstractServer.java:553)
	- locked <0x0000000813005460> (a ca.uottawa.ui.ScheduleGeneratorServer)
	at com.lloseng.ocsf.server.ConnectionToClient.run(ConnectionToClient.java:257)

"Thread-58" #68 prio=5 os_prio=15 tid=0x000000080175e800 nid=0x1894c waiting for monitor entry [0x00007fffde9e7000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at com.lloseng.ocsf.server.AbstractServer.run(AbstractServer.java:408)
	- waiting to lock <0x0000000813005460> (a ca.uottawa.ui.ScheduleGeneratorServer)
	at java.lang.Thread.run(Thread.java:748)

"DestroyJavaVM" #10 prio=5 os_prio=15 tid=0x000000080302c000 nid=0x18701 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Service Thread" #8 daemon prio=9 os_prio=15 tid=0x00000008d399c000 nid=0x18908 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C1 CompilerThread2" #7 daemon prio=9 os_prio=15 tid=0x0000000803031800 nid=0x18905 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" #6 daemon prio=9 os_prio=15 tid=0x0000000803030800 nid=0x18902 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #5 daemon prio=9 os_prio=15 tid=0x0000000803030000 nid=0x18900 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" #4 daemon prio=9 os_prio=15 tid=0x000000080302f000 nid=0x188fd waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" #3 daemon prio=8 os_prio=15 tid=0x000000080302e800 nid=0x188fc in Object.wait() [0x00007fffdf8f6000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
	- locked <0x0000000813005240> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
	at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:212)

"Reference Handler" #2 daemon prio=10 os_prio=15 tid=0x000000080302d800 nid=0x188fb in Object.wait() [0x00007fffdf9f7000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	at java.lang.Object.wait(Object.java:502)
	at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
	- locked <0x00000008130053f8> (a java.lang.ref.Reference$Lock)
	at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)

"VM Thread" os_prio=15 tid=0x00000008030ac000 nid=0x188f9 runnable 

"GC task thread#0 (ParallelGC)" os_prio=15 tid=0x00000008030a8000 nid=0x188f1 runnable 

"GC task thread#1 (ParallelGC)" os_prio=15 tid=0x00000008030a9000 nid=0x188f3 runnable 

"GC task thread#2 (ParallelGC)" os_prio=15 tid=0x00000008030a9800 nid=0x188f6 runnable 

"GC task thread#3 (ParallelGC)" os_prio=15 tid=0x00000008030aa000 nid=0x188f8 runnable 

"VM Periodic Task Thread" os_prio=15 tid=0x00000008030ac800 nid=0x1890b waiting on condition 

JNI global references: 196

Heap
 PSYoungGen      total 438272K, used 229376K [0x0000000865000000, 0x000000088d800000, 0x000000088de00000)
  eden space 229376K, 100% used [0x0000000865000000,0x0000000873000000,0x0000000873000000)
  from space 208896K, 0% used [0x0000000873000000,0x0000000873000000,0x000000087fc00000)
  to   space 208896K, 0% used [0x0000000880c00000,0x0000000880c00000,0x000000088d800000)
 ParOldGen       total 1343488K, used 1329890K [0x0000000813000000, 0x0000000865000000, 0x0000000865000000)
  object space 1343488K, 98% used [0x0000000813000000,0x00000008642b8a08,0x0000000865000000)
 Metaspace       used 7338K, capacity 7492K, committed 7808K, reserved 1056768K
  class space    used 698K, capacity 766K, committed 896K, reserved 1048576K

Haven't observed this crash since May of last year and was unable to reproduce, closing the issue for now.