From 1b94e1c2e0768faab27a44478167ccd930d428fc Mon Sep 17 00:00:00 2001 From: Misode Date: Fri, 27 Dec 2024 15:38:44 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20Add=20some=20debug=20logs=20to?= =?UTF-8?q?=20investigate=20#1609?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/service/Downloader.ts | 8 +++++--- packages/core/src/service/FileService.ts | 23 ++++++++++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/core/src/service/Downloader.ts b/packages/core/src/service/Downloader.ts index b3fe07989..7c5e567cf 100644 --- a/packages/core/src/service/Downloader.ts +++ b/packages/core/src/service/Downloader.ts @@ -74,7 +74,7 @@ export class Downloader { const deserializer = cache.deserializer ?? ((b) => b) const ans = await transformer(deserializer(cachedBuffer)) this.logger.info( - `[Downloader] [${id}] Skipped downloading thanks to cache ${cacheChecksum}`, + `[Downloader] [${id}] Skipped downloading thanks to cache ${cacheChecksum} (${cachedBuffer.length} bytes)`, ) return ans } catch (e) { @@ -132,7 +132,7 @@ export class Downloader { this.logger.error(`[Downloader] [${id}] Caching file ${cacheUri}`, e) } } - this.logger.info(`[Downloader] [${id}] Downloaded from ${uri}`) + this.logger.info(`[Downloader] [${id}] Downloaded from ${uri} (${buffer.length} bytes)`) return await transformer(buffer) } catch (e) { this.logger.error(`[Downloader] [${id}] Downloading ${uri}`, e) @@ -141,7 +141,9 @@ export class Downloader { const cachedBuffer = await fileUtil.readFile(this.externals, cacheUri) const deserializer = cache.deserializer ?? ((b) => b) const ans = await transformer(deserializer(cachedBuffer)) - this.logger.warn(`[Downloader] [${id}] Fell back to cached file ${cacheUri}`) + this.logger.warn( + `[Downloader] [${id}] Fell back to cached file ${cacheUri} (${cachedBuffer.length} bytes)`, + ) return ans } catch (e) { this.logger.error( diff --git a/packages/core/src/service/FileService.ts b/packages/core/src/service/FileService.ts index 4db69419c..06691d99f 100644 --- a/packages/core/src/service/FileService.ts +++ b/packages/core/src/service/FileService.ts @@ -340,18 +340,35 @@ export class ArchiveUriSupporter implements UriProtocolSupporter { if (entries.has(archiveName)) { throw new Error(`A different URI with ${archiveName} already exists`) } - + /// Debug message for #1609 + logger.info( + `[ArchiveUriSupporter#create] Extracting archive ${archiveName} from ${uri}`, + ) const files = await externals.archive.decompressBall( await externals.fs.readFile(uri), { stripLevel: typeof info?.startDepth === 'number' ? info.startDepth : 0 }, ) - entries.set(archiveName, new Map(files.map((f) => [f.path.replace(/\\/g, '/'), f]))) + const newEntries = new Map(files.map((f) => [f.path.replace(/\\/g, '/'), f])) + /// Debug message for #1609 + logger.info( + `[ArchiveUriSupporter#create] Extracted ${files.length} files, adding ${newEntries.size} entries`, + ) + for (const [path, entry] of [...newEntries.entries()].slice(0, 20)) { + logger.info(`[ArchiveUriSupporter#create] ${path} (${entry.data.length} bytes)`) + } + entries.set(archiveName, newEntries) } } catch (e) { - logger.error(`[SpyglassUriSupporter#create] Bad dependency ${uri}`, e) + logger.error(`[ArchiveUriSupporter#create] Bad dependency ${uri}`, e) } } + /// Debug message for #1609 + logger.info( + `[ArchiveUriSupporter#create] Finalizing with ${entries.size} archives: ${[ + ...entries.keys(), + ]}`, + ) return new ArchiveUriSupporter(externals, entries) } }