Skip to content

Commit f3ddc39

Browse files
committed
improved geometry runner logging, to facilitate solution to #1334
- unique thread names (GeometryRunner-x) - log alle Throwables (e.g. OutOfMemoryError) not just Exception - don't attempt to write debug file after failed loading from database - log wheteher proper shutdown or timeout has happened
1 parent 06b1e07 commit f3ddc39

File tree

3 files changed

+56
-55
lines changed

3 files changed

+56
-55
lines changed

BimServer/src/org/bimserver/geometry/GeometryRunner.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ public GeometryRunner(StreamingGeometryGenerator streamingGeometryGenerator, ECl
125125

126126
@Override
127127
public void run() {
128-
Thread.currentThread().setName("GeometryRunner");
128+
Thread.currentThread().setName("GeometryRunner-" + job.getId());
129+
129130
long start = System.nanoTime();
130131
job.setStartNanos(start);
131132

@@ -181,7 +182,6 @@ public void newObject(HashMapVirtualObject next) {
181182
}
182183
});
183184
serializer.init(proxy, null, null, this.streamingGeometryGenerator.bimServer.getPluginManager(), this.streamingGeometryGenerator.packageMetaData);
184-
185185
ByteArrayOutputStream baos = new ByteArrayOutputStream();
186186
IOUtils.copy(serializer.getInputStream(), baos);
187187
bytes = baos.toByteArray();
@@ -838,13 +838,13 @@ public void newObject(HashMapVirtualObject next) {
838838
this.streamingGeometryGenerator.jobsDone.incrementAndGet();
839839
this.streamingGeometryGenerator.updateProgress();
840840
}
841-
} catch (Exception e) {
841+
} catch (Throwable e) {
842842
StreamingGeometryGenerator.LOGGER.error("", e);
843-
writeDebugFile(bytes, true, null);
843+
if(bytes!=null) writeDebugFile(bytes, true, null);
844844
job.setException(e);
845845
// LOGGER.error("Original query: " + originalQuery, e);
846846
}
847-
} catch (Exception e) {
847+
} catch (Throwable e) {
848848
StreamingGeometryGenerator.LOGGER.error("", e);
849849
// LOGGER.error("Original query: " + originalQuery, e);
850850
}
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
package org.bimserver.geometry;
2-
3-
/******************************************************************************
4-
* Copyright (C) 2009-2019 BIMserver.org
5-
*
6-
* This program is free software: you can redistribute it and/or modify
7-
* it under the terms of the GNU Affero General Public License as
8-
* published by the Free Software Foundation, either version 3 of the
9-
* License, or (at your option) any later version.
10-
*
11-
* This program is distributed in the hope that it will be useful,
12-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
* GNU Affero General Public License for more details.
15-
*
16-
* You should have received a copy of the GNU Affero General Public License
17-
* along with this program. If not, see {@literal<http://www.gnu.org/licenses/>}.
18-
*****************************************************************************/
19-
20-
import java.util.HashMap;
1+
package org.bimserver.geometry;
2+
3+
/******************************************************************************
4+
* Copyright (C) 2009-2019 BIMserver.org
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with this program. If not, see {@literal<http://www.gnu.org/licenses/>}.
18+
*****************************************************************************/
19+
20+
import java.util.HashMap;
2121
import java.util.Map;
2222

2323
public class ReportJob {
2424

2525
private Map<Long, String> objects = new HashMap<>();
26-
private Exception exception;
26+
private Throwable exception;
2727
private long end;
28-
private long start;
28+
private long start;
2929
private long cpuTimeMs;
3030
private String mainType;
3131
private int nrObjects;
3232
private boolean usesMapping;
3333
private int trianglesGenerated;
3434
private GeometryGenerationReport report;
35-
private int id;
35+
private int id;
3636
private long maxMemoryBytes;
3737

3838
public ReportJob(GeometryGenerationReport report, String mainType, int nrObjects) {
@@ -45,11 +45,11 @@ public String getMainType() {
4545
return mainType;
4646
}
4747

48-
public void addObject(long oid, String name) {
48+
public void addObject(long oid, String name) {
4949
objects.put(oid, name);
5050
}
5151

52-
public void setException(Exception exception) {
52+
public void setException(Throwable exception) {
5353
this.exception = exception;
5454
}
5555

@@ -69,7 +69,7 @@ public Map<Long, String> getObjects() {
6969
return objects;
7070
}
7171

72-
public Exception getException() {
72+
public Throwable getException() {
7373
return exception;
7474
}
7575

@@ -96,28 +96,28 @@ public int getTrianglesGenerated() {
9696
public GeometryGenerationReport getReport() {
9797
return report;
9898
}
99-
100-
public void setId(int id) {
101-
this.id = id;
102-
}
103-
104-
public int getId() {
105-
return id;
106-
}
107-
108-
public long getCpuTimeMs() {
109-
return cpuTimeMs;
110-
}
111-
112-
public void setCpuTimeMs(long cpuTimeMs) {
113-
this.cpuTimeMs = cpuTimeMs;
114-
}
115-
116-
public void setMaxMemoryBytes(long maxMemoryBytes) {
117-
this.maxMemoryBytes = maxMemoryBytes;
118-
}
119-
120-
public long getMaxMemoryBytes() {
121-
return maxMemoryBytes;
99+
100+
public void setId(int id) {
101+
this.id = id;
102+
}
103+
104+
public int getId() {
105+
return id;
106+
}
107+
108+
public long getCpuTimeMs() {
109+
return cpuTimeMs;
110+
}
111+
112+
public void setCpuTimeMs(long cpuTimeMs) {
113+
this.cpuTimeMs = cpuTimeMs;
114+
}
115+
116+
public void setMaxMemoryBytes(long maxMemoryBytes) {
117+
this.maxMemoryBytes = maxMemoryBytes;
118+
}
119+
120+
public long getMaxMemoryBytes() {
121+
return maxMemoryBytes;
122122
}
123123
}

BimServer/src/org/bimserver/geometry/StreamingGeometryGenerator.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,8 @@ public GenerateGeometryResult generateGeometry(long uoid, final DatabaseSession
627627
allJobsPushed = true;
628628

629629
executor.shutdown();
630-
executor.awaitTermination(24, TimeUnit.HOURS);
630+
boolean terminated = executor.awaitTermination(24, TimeUnit.HOURS);
631+
LOGGER.info(executor.getCompletedTaskCount() +"/"+executor.getTaskCount()+" jobs executed and " + (terminated ? "shutdown" : "timeout"));
631632
// LOGGER.info(executor.getCompletedTaskCount() + " jobs executed");
632633

633634
// Need total bounds

0 commit comments

Comments
 (0)