Skip to content

Commit

Permalink
improved geometry runner logging, to facilitate solution to #1334
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
hlg committed Jan 24, 2025
1 parent 06b1e07 commit f3ddc39
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 55 deletions.
10 changes: 5 additions & 5 deletions BimServer/src/org/bimserver/geometry/GeometryRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ public GeometryRunner(StreamingGeometryGenerator streamingGeometryGenerator, ECl

@Override
public void run() {
Thread.currentThread().setName("GeometryRunner");
Thread.currentThread().setName("GeometryRunner-" + job.getId());

long start = System.nanoTime();
job.setStartNanos(start);

Expand Down Expand Up @@ -181,7 +182,6 @@ public void newObject(HashMapVirtualObject next) {
}
});
serializer.init(proxy, null, null, this.streamingGeometryGenerator.bimServer.getPluginManager(), this.streamingGeometryGenerator.packageMetaData);

ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copy(serializer.getInputStream(), baos);
bytes = baos.toByteArray();
Expand Down Expand Up @@ -838,13 +838,13 @@ public void newObject(HashMapVirtualObject next) {
this.streamingGeometryGenerator.jobsDone.incrementAndGet();
this.streamingGeometryGenerator.updateProgress();
}
} catch (Exception e) {
} catch (Throwable e) {
StreamingGeometryGenerator.LOGGER.error("", e);
writeDebugFile(bytes, true, null);
if(bytes!=null) writeDebugFile(bytes, true, null);
job.setException(e);
// LOGGER.error("Original query: " + originalQuery, e);
}
} catch (Exception e) {
} catch (Throwable e) {
StreamingGeometryGenerator.LOGGER.error("", e);
// LOGGER.error("Original query: " + originalQuery, e);
}
Expand Down
98 changes: 49 additions & 49 deletions BimServer/src/org/bimserver/geometry/ReportJob.java
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
package org.bimserver.geometry;

/******************************************************************************
* Copyright (C) 2009-2019 BIMserver.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see {@literal<http://www.gnu.org/licenses/>}.
*****************************************************************************/

import java.util.HashMap;
package org.bimserver.geometry;

/******************************************************************************
* Copyright (C) 2009-2019 BIMserver.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see {@literal<http://www.gnu.org/licenses/>}.
*****************************************************************************/

import java.util.HashMap;
import java.util.Map;

public class ReportJob {

private Map<Long, String> objects = new HashMap<>();
private Exception exception;
private Throwable exception;
private long end;
private long start;
private long start;
private long cpuTimeMs;
private String mainType;
private int nrObjects;
private boolean usesMapping;
private int trianglesGenerated;
private GeometryGenerationReport report;
private int id;
private int id;
private long maxMemoryBytes;

public ReportJob(GeometryGenerationReport report, String mainType, int nrObjects) {
Expand All @@ -45,11 +45,11 @@ public String getMainType() {
return mainType;
}

public void addObject(long oid, String name) {
public void addObject(long oid, String name) {
objects.put(oid, name);
}

public void setException(Exception exception) {
public void setException(Throwable exception) {
this.exception = exception;
}

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

public Exception getException() {
public Throwable getException() {
return exception;
}

Expand All @@ -96,28 +96,28 @@ public int getTrianglesGenerated() {
public GeometryGenerationReport getReport() {
return report;
}

public void setId(int id) {
this.id = id;
}

public int getId() {
return id;
}

public long getCpuTimeMs() {
return cpuTimeMs;
}

public void setCpuTimeMs(long cpuTimeMs) {
this.cpuTimeMs = cpuTimeMs;
}

public void setMaxMemoryBytes(long maxMemoryBytes) {
this.maxMemoryBytes = maxMemoryBytes;
}

public long getMaxMemoryBytes() {
return maxMemoryBytes;

public void setId(int id) {
this.id = id;
}

public int getId() {
return id;
}

public long getCpuTimeMs() {
return cpuTimeMs;
}

public void setCpuTimeMs(long cpuTimeMs) {
this.cpuTimeMs = cpuTimeMs;
}

public void setMaxMemoryBytes(long maxMemoryBytes) {
this.maxMemoryBytes = maxMemoryBytes;
}

public long getMaxMemoryBytes() {
return maxMemoryBytes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,8 @@ public GenerateGeometryResult generateGeometry(long uoid, final DatabaseSession
allJobsPushed = true;

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

// Need total bounds
Expand Down

0 comments on commit f3ddc39

Please sign in to comment.