Merge pull request #373 from opengenesislink/fix/iar-nexbus-nonblocking-asset-diagnostics-20261103
fix(iar): keep NexBus HTTP responsive during archive and expose missing-asset causes
This commit is contained in:
4 files changed
+122
No files matched your search
@@ -99,6 +99,13 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
private readonly ConcurrentDictionary<string, long> m_NodeUpdateReplay = new();
|
||||
private IDisposable m_OarControlSubscription;
|
||||
private IDisposable m_IarControlSubscription;
|
||||
// IAR export/import is synchronous in the native OpenSim archiver.
|
||||
// Never perform it on the authenticated NexBus HTTP request thread.
|
||||
// One active archive per simulator node avoids competing large I/O jobs;
|
||||
// reserve at most eight queued/running requests to bound memory.
|
||||
private const int MaxPendingIarCommands = 8;
|
||||
private readonly SemaphoreSlim m_IarCommandSlot = new(1, 1);
|
||||
private int m_IarCommandsPending;
|
||||
private OglIarWebDavStorage m_IarWebDav;
|
||||
private long m_IarWebDavMaximumBytes = 2048L * 1024 * 1024;
|
||||
private IDisposable m_ObjectMessageSubscription;
|
||||
@@ -1985,6 +1992,71 @@ namespace NexVerse.RegionModules.NodeAgent
|
||||
|| !TryCommandData(nexEvent, "inventory_path", out string inventoryPath))
|
||||
return;
|
||||
|
||||
// The shared event bus dispatches handlers synchronously. Native
|
||||
// ArchiveInventory/AssetService/Get and GZip + WebDAV can take
|
||||
// minutes; executing them here would block the NexBus POST.
|
||||
if (Volatile.Read(ref m_Stopping) != 0)
|
||||
return;
|
||||
if (Interlocked.Increment(ref m_IarCommandsPending) > MaxPendingIarCommands)
|
||||
{
|
||||
Interlocked.Decrement(ref m_IarCommandsPending);
|
||||
m_Log.WarnFormat("[OGL-IAR]: IAR request {0} rejected: the node's bounded archive queue is full.",
|
||||
operationId);
|
||||
PublishIarState(nexEvent, operationId, regionId, action,
|
||||
"failed", "iar_node_busy", 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
bool acquired = false;
|
||||
try
|
||||
{
|
||||
await m_IarCommandSlot.WaitAsync().ConfigureAwait(false);
|
||||
acquired = true;
|
||||
if (Volatile.Read(ref m_Stopping) != 0)
|
||||
return;
|
||||
ProcessIarCommand(nexEvent, operationId, regionId, userId,
|
||||
action, fileName, inventoryPath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_Log.Error("[OGL-IAR]: Background IAR command failed for " + operationId + ".", e);
|
||||
if (Volatile.Read(ref m_Stopping) == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
PublishIarState(nexEvent, operationId, regionId, action,
|
||||
"failed", "iar_worker_failed", 0, 0);
|
||||
}
|
||||
catch (Exception report)
|
||||
{
|
||||
m_Log.Error("[OGL-IAR]: Could not publish terminal IAR worker failure.", report);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (acquired)
|
||||
m_IarCommandSlot.Release();
|
||||
Interlocked.Decrement(ref m_IarCommandsPending);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Interlocked.Decrement(ref m_IarCommandsPending);
|
||||
m_Log.Error("[OGL-IAR]: Could not schedule background IAR command.", e);
|
||||
PublishIarState(nexEvent, operationId, regionId, action,
|
||||
"failed", "iar_worker_unavailable", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProcessIarCommand(NexEvent nexEvent, UUID operationId, UUID regionId,
|
||||
UUID userId, string action, string fileName, string inventoryPath)
|
||||
{
|
||||
if (!m_Scenes.TryGetValue(regionId, out Scene scene))
|
||||
{
|
||||
PublishIarState(nexEvent, operationId, regionId, action, "failed", "region_not_loaded", 0, 0);
|
||||
|
||||
@@ -196,6 +196,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
m_log.WarnFormat("[ARCHIVER]: {0} Assets gesichert; {1} angeforderte Einträge waren nicht auffindbar, beschädigt oder keine gültigen Assets (Archiv möglicherweise unvollständig).",
|
||||
m_foundAssetUuids.Count, totalerrors);
|
||||
|
||||
if (totalerrors > 0)
|
||||
{
|
||||
// The headline count combines errors detected while scanning
|
||||
// inventory asset references with AssetService.Get misses.
|
||||
// Keep the details in the restricted simulator log; do not
|
||||
// disclose inventory identifiers via portal/NexBus responses.
|
||||
m_log.WarnFormat("[ARCHIVER]: Fehlende Assets nach Ursache: {0} beim AssetService nicht auffindbar; {1} ungueltige/beschaedigte Referenzen aus der Inventarvorpruefung.",
|
||||
m_notFoundAssetUuids.Count, m_previousErrorsCount);
|
||||
int sample = Math.Min(10, m_notFoundAssetUuids.Count);
|
||||
for (int i = 0; i < sample; i++)
|
||||
m_log.WarnFormat("[ARCHIVER]: Fehlende Asset-UUID Beispiel {0}/{1}: {2}",
|
||||
i + 1, m_notFoundAssetUuids.Count, m_notFoundAssetUuids[i]);
|
||||
if (m_notFoundAssetUuids.Count > sample)
|
||||
m_log.WarnFormat("[ARCHIVER]: Weitere {0} fehlende AssetService-UUIDs nicht einzeln protokolliert.",
|
||||
m_notFoundAssetUuids.Count - sample);
|
||||
}
|
||||
|
||||
// Hand off to the TAR/GZip finalizer without a forced, potentially
|
||||
// long stop-the-world full GC after the last asset.
|
||||
m_log.InfoFormat("[ARCHIVER]: Asset-Abruf abgeschlossen: {0} gespeichert, {1} fehlend/ungueltig, Zeitueberschreitung={2}; Archivabschluss wird gestartet.",
|
||||
|
||||
@@ -133,6 +133,25 @@ Das URI-Präfix der Stadt-NexVerse-G1-Installation lautet
|
||||
keine Schreibberechtigung für MKCOL und PUT. TLS-Zertifikatsprüfung
|
||||
darf auch bei der Fehlersuche nicht abgeschaltet werden.
|
||||
|
||||
### Große Inventare: NexBus-Laufzeit und fehlende Asset-Referenzen
|
||||
|
||||
Der NexBus-HTTP-Endpunkt darf nicht durch eine komplette IAR-Inventararchivierung
|
||||
blockiert werden. Der Simulator nimmt authentifizierte IAR-Befehle jetzt
|
||||
entkoppelt an; die eigentliche native Export-/Import-Arbeit wird in einer
|
||||
begrenzt langen Warteschlange ausgeführt (höchstens acht ausstehende,
|
||||
höchstens ein aktiver IAR-Auftrag pro Simulator-Node). Bei Überlast meldet
|
||||
der Auftrag `iar_node_busy`; bei einem unerwarteten Workerfehler
|
||||
`iar_worker_failed`. Die Rückmeldung `queued` bedeutet nicht,
|
||||
dass ein Archiv fertig geschrieben oder per WebDAV bestätigt ist.
|
||||
|
||||
Die Archiv-Konsolenmeldung `Assets gesichert; ... nicht auffindbar`
|
||||
ist nicht als vollständige Sicherung zu interpretieren. Der Zähler
|
||||
beinhaltet sowohl bereits bei der Inventarvorprüfung beschädigte Referenzen
|
||||
als auch später fehlende Antworten des AssetService. Das Simulatorlog
|
||||
protokolliert diese Teilmengen getrennt und zeigt höchstens zehn
|
||||
Beispiel-Asset-UUIDs zur gezielten AssetService-Diagnose. Das repariert
|
||||
keine fehlenden Assets und ersetzt keine Import-/Restore-Prüfung.
|
||||
|
||||
### Retention – maximal 30 Tage
|
||||
|
||||
- Neue Self-Service-Archive erhalten eine eindeutige
|
||||
|
||||
@@ -194,3 +194,17 @@ preflight = dav.split("public void EnsureRegion(Guid region)", 1)[1].split(
|
||||
"public void CreateMarker(Guid region", 1)[0]
|
||||
assert "HttpStatusCode.Conflict" not in preflight, "MKCOL HTTP 409 must fail"
|
||||
assert "HttpStatusCode.MethodNotAllowed" in preflight
|
||||
# Native asset streaming must not block the signed NexBus HTTP POST.
|
||||
assets_request = text("OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs")
|
||||
assert "private const int MaxPendingIarCommands = 8;" in node
|
||||
assert "private readonly SemaphoreSlim m_IarCommandSlot = new(1, 1);" in node
|
||||
assert "Interlocked.Increment(ref m_IarCommandsPending)" in node
|
||||
assert "m_IarCommandSlot.WaitAsync().ConfigureAwait(false)" in node
|
||||
assert "Task.Run(async () =>" in node
|
||||
assert "ProcessIarCommand(nexEvent, operationId, regionId, userId," in node
|
||||
assert "Interlocked.Decrement(ref m_IarCommandsPending);" in node
|
||||
assert '"iar_node_busy"' in node and '"iar_worker_failed"' in node
|
||||
assert "Fehlende Assets nach Ursache:" in assets_request
|
||||
assert "m_notFoundAssetUuids.Count, m_previousErrorsCount" in assets_request
|
||||
assert "Math.Min(10, m_notFoundAssetUuids.Count)" in assets_request
|
||||
print("IAR NexBus nonblocking bounded dispatch and missing-asset diagnostics PASS")
|
||||
Reference in new issue
Block a user