Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object.Exception@../src/asgen/contentsstore.d(67): mdb_txn_begin[22]: Invalid argument #85

Closed
z3ntu opened this issue Sep 12, 2020 · 18 comments
Assignees
Labels

Comments

@z3ntu
Copy link

z3ntu commented Sep 12, 2020

I'm getting the following exception running appstream-generator with the Alpine backend:

object.Exception@../src/asgen/contentsstore.d(67): mdb_txn_begin[22]: Invalid argument
----------------
contentsstore.d:67 void asgen.contentsstore.ContentsStore.checkError(int, immutable(char)[]) [0x561a864d1d31]
contentsstore.d:152 asgen.bindings.lmdb.MDB_txn_s* asgen.contentsstore.ContentsStore.newTransaction(uint) [0x561a864d24e3]
contentsstore.d:201 bool asgen.contentsstore.ContentsStore.packageExists(immutable(char)[]) [0x561a864d27d4]
engine.d:235 int asgen.engine.Engine.seedContentsData(asgen.config.Suite, immutable(char)[], immutable(char)[], asgen.backends.interfaces.Package[]).__foreachbody7(ref asgen.backends.interfaces.Package) [0x561a8651281a]
/usr/include/dlang/ldc/std/parallelism.d-mixin-4048:4094 void std.parallelism.ParallelForeach!(asgen.backends.interfaces.Package[]).ParallelForeach.opApply(scope int delegate(ref asgen.backends.interfaces.Package)).doIt() [0x561a8651c25c]
??:? void std.parallelism.TaskPool.executeWorkLoop() [0x7f35e05fb76f]
??:? thread_entryPoint [0x7f35e02ad689]
??:? [0x7f35e01d63e8]
??:? clone [0x7f35e00ea292]

Any idea what happens there? My workdir was clean before running appstream-generator

@ximion
Copy link
Owner

ximion commented Sep 12, 2020

Very odd. This was on en empty workspace with no preexisting caches? Which exact version of lmdb are you using? (asgen will tell you the version when started in verbose mode at the beginning of the log)

@z3ntu
Copy link
Author

z3ntu commented Sep 13, 2020

Using LMDB 0.9.26: (August 11, 2020) major=0 minor=9 patch=26

Also it seems to only happen on my setup when it starts processing the second architecture of the suite (e.g. "architectures": ["aarch64", "x86_64"]). When removing e.g. x86_64 from the list here everything works fine.

@ximion
Copy link
Owner

ximion commented Sep 13, 2020

That's likely because the cache is only full after parsing the second architecture, triggering this bug. You are not running multiple instances of asgen in parallel, right? (that wouldn't be supported).
The EINVAL error suggests an invalid parameter, but the parameters are correct, according to the documentation. I don't suppose you have a small test case I can use to reproduce this issue? Also, when looking at LMDBs code, it's really unlikely for this function to return EINVAL.

You could change like 201 in contentsstore.d from auto txn = newTransaction (MDB_RDONLY); to auto txn = newTransaction (); just in case LMDB doesn't like a read-only transaction here - but it really should allow us to create one. You could also add a logInfo ("!! Flags is: %X", flags); to line 150 just to see if we really pass 0x20000 as flag (I don't see why we wouldn't).

As said, transaction creation failure is a very odd failure mode :-/

@z3ntu
Copy link
Author

z3ntu commented Sep 13, 2020

Didn't help :( There are a bunch of INFO: !! Flags is: 20000 lines so that looks fine. Here's the complete logs if that's more useful:

asgen.log

@ximion
Copy link
Owner

ximion commented Sep 19, 2020

Really very strange - did anything change to trigger this?
Can you provide me with some information how to reproduce this? /Maybe the packages that drigger this and the configuration)

@z3ntu
Copy link
Author

z3ntu commented Sep 20, 2020

You can try yourself, I'm using this config:

{
"ProjectName": "postmarketOS",
"ArchiveRoot": "http://mirror.postmarketos.org/postmarketos/",
"Backend": "alpinelinux",
"Features":
  {
    "validateMetainfo": false,
    "createScreenshotsStore": false,
    "noDownloads": false
  },
"Suites":
  {
    "v20.05":
      {
        "sections": ["postmarketos"],
        "architectures": ["aarch64", "x86_64"]
      }
  }
}

with the command ../appstream-generator-src/builddir/src/asgen/appstream-generator run --verbose v20.05

@antonio-rojas
Copy link
Contributor

I just hit this when trying to generate the Arch Linux metadata. I ran the generator on Aug 28th successfully for the last time, since then the only relevant change that I notice is an ldc update - but I can also reproduce the issue with the previous ldc version.

For me it happens when moving from one section (repo) to the next one. Indexing a single repo works fine.

@ximion
Copy link
Owner

ximion commented Oct 22, 2020

Can you reproduce this every time as well? This is such a weird error, I really need to find a way to reproduce this (in the worst case by installing a VM/container/chroot with Arch, but for that I need to find the time).

@antonio-rojas
Copy link
Contributor

Yes, this is 100% reproducible. The weird thing is, I can still reproduce it after downgrading all packges to the point in time when I last ran the generator successfully. I'm not aware of any changes in the repos database format since then. Here is a minimal test case.

appstream-test.tar.gz

@ximion
Copy link
Owner

ximion commented Nov 2, 2020

@antonio-rojas Thank you for that great testcase!
Unfortunately, I can still not reproduce the issue, but my LMDB version is older than yours:

appstream-generator process arch --verbose --force
2020-11-02 18:35:23 - DEBUG: Using `optipng`: /usr/bin/optipng
2020-11-02 18:35:23 - DEBUG: Using `ffprobe`: /usr/bin/ffprobe
2020-11-02 18:35:23 - WARNING: Configuration does not permit downloading files. Several features will not be available.
2020-11-02 18:35:23 - DEBUG: Using LMDB 0.9.24: (July 24, 2019) major=0 minor=9 patch=24
2020-11-02 18:35:23 - DEBUG: Opening contents cache.
2020-11-02 18:35:23 - INFO: AppStream Generator 0.8.3, AS: 0.12.12 [Arch Linux]
2020-11-02 18:35:23 - INFO: Scanning new packages for arch/core [x86_64]
2020-11-02 18:35:23 - DEBUG: Opened: ./core/os/x86_64/core.files.tar.gz
2020-11-02 18:35:23 - DEBUG: Opened: ./extra/os/x86_64/extra.files.tar.gz
2020-11-02 18:35:23 - DEBUG: Creating new IconHandler
2020-11-02 18:35:23 - DEBUG: Opening contents cache.
2020-11-02 18:35:23 - INFO: No packaged hicolor icon theme found, using built-in one.
2020-11-02 18:35:23 - DEBUG: Created new IconHandler.
2020-11-02 18:35:23 - DEBUG: Creating new LocaleHandler.
2020-11-02 18:35:23 - DEBUG: Opening contents cache.
2020-11-02 18:35:23 - DEBUG: Created new LocaleHandler.
2020-11-02 18:35:23 - INFO: Exporting data for arch (core/x86_64)
2020-11-02 18:35:23 - DEBUG: Building final metadata and hints files.
2020-11-02 18:35:23 - INFO: Creating icon tarball.
2020-11-02 18:35:23 - INFO: Icon tarball(s) built.
2020-11-02 18:35:23 - INFO: Writing metadata for arch/core [x86_64]
2020-11-02 18:35:23 - INFO: Writing hints for arch/core [x86_64]
2020-11-02 18:35:23 - INFO: Completed processing of arch/core [x86_64]
2020-11-02 18:35:23 - DEBUG: GC collection cycle triggered explicitly.
2020-11-02 18:35:23 - INFO: Collecting data about hints and available metainfo for arch/core
2020-11-02 18:35:23 - INFO: Rendering HTML for arch/core
2020-11-02 18:35:23 - DEBUG: Rendering HTML page: arch/core/issues/links
2020-11-02 18:35:23 - DEBUG: Rendering HTML page: arch/core/metainfo/links
2020-11-02 18:35:23 - DEBUG: Rendering HTML page: arch/core/issues/index
2020-11-02 18:35:23 - DEBUG: Rendering HTML page: arch/core/metainfo/index
2020-11-02 18:35:23 - DEBUG: Rendering HTML page: arch/core/index
2020-11-02 18:35:23 - DEBUG: GC collection cycle triggered explicitly.
2020-11-02 18:35:23 - INFO: Scanning new packages for arch/extra [x86_64]
2020-11-02 18:35:23 - DEBUG: Opened: ./extra/os/x86_64/extra.files.tar.gz
2020-11-02 18:35:23 - INFO: Skipping arch/extra [x86_64], no interesting new packages since last update.
2020-11-02 18:35:23 - DEBUG: GC collection cycle triggered explicitly.
2020-11-02 18:35:23 - INFO: Updating HTML index pages and static data.
2020-11-02 18:35:23 - DEBUG: Rendering HTML page: arch/index
2020-11-02 18:35:23 - DEBUG: Rendering HTML page: index
2020-11-02 18:35:23 - INFO: Exporting statistical data.

This was run on the current Git master version of appstream-generator. Looks like I'll have to upgrade at least LMDB for this.

@ximion
Copy link
Owner

ximion commented Jan 24, 2021

Silly question, but: Where did you get LMDB 0.9.26 from?
According to https://github.com/LMDB/lmdb/releases, the latest release is 0.9.24, and that's the one I am using.
Also, it may be a good idea to test this again with the bleeding edge AppStream 0.14.0 (Git master) and appstream-generator (Git master) - combined, those projects contain some memory management changes and fixes, which may or may not help here (probably the latter, but you never know... - in any case, they will reduce memory usage by a lot).

@antonio-rojas
Copy link
Contributor

Silly question, but: Where did you get LMDB 0.9.26 from?
According to https://github.com/LMDB/lmdb/releases, the latest release is 0.9.24, and that's the one I am using.

That mirror seems to no longer be synced. The official repo is https://git.openldap.org/openldap/openldap/tree/mdb.master (latest version is 0.9.27)

@antonio-rojas
Copy link
Contributor

antonio-rojas commented Jan 24, 2021

With appstream{,-generator} from git master I get the same result on the same machines. In the meantime, I got a new laptop, and in this one it simply hangs

(gdb) thread apply all bt 

Thread 15 (Thread 0x7fdfd17fa640 (LWP 5779) "appstream-gener"):
#0  0x00007ffff70f8db0 in __lll_lock_wait () at /usr/lib/libpthread.so.0
#1  0x00007ffff70f17d1 in pthread_mutex_lock () at /usr/lib/libpthread.so.0
#2  0x00007ffff71e9021 in _d_monitorenter () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x000055555571cf55 in asgen.contentsstore.ContentsStore.addContents(immutable(char)[], immutable(char)[][]) ()
#4  0x000055555575ca9d in asgen.engine.Engine.seedContentsData(asgen.config.Suite, immutable(char)[], immutable(char)[], asgen.backends.interfaces.Package[]).__foreachbody7(ref asgen.backends.interfaces.Package) ()
#5  0x00005555557646dd in std.parallelism.ParallelForeach!(asgen.backends.interfaces.Package[]).ParallelForeach.opApply(scope int(ref asgen.backends.interfaces.Package) delegate).doIt() ()
#6  0x00007ffff750f6a0 in std.parallelism.TaskPool.executeWorkLoop() () at /usr/lib/libphobos2-ldc-shared.so.94
#7  0x00007ffff71c0aaa in thread_entryPoint () at /usr/lib/libdruntime-ldc-shared.so.94
#8  0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#9  0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 14 (Thread 0x7fdfd1ffb640 (LWP 5778) "appstream-gener"):
#0  0x00007ffff6e84c51 in clock_nanosleep@GLIBC_2.2.5 () at /usr/lib/libc.so.6
#1  0x00007ffff6e8a137 in nanosleep () at /usr/lib/libc.so.6
#2  0x00007ffff71c1249 in core.thread.osthread.Thread.sleep(core.time.Duration) () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x00007ffff71b7eb2 in core.internal.spinlock.SpinLock.lock() shared () at /usr/lib/libdruntime-ldc-shared.so.94
#4  0x00007ffff71c7690 in gc.impl.conservative.gc.ConservativeGC.runLocked!(gc.impl.conservative.gc.ConservativeGC.mallocNoSync(ulong, uint, ref ulong, const(TypeInfo)), gc.impl.conservative.gc.mallocTime, gc.impl.conservative.gc.numMallocs, ulong, uint, ulong, const(TypeInfo)).runLocked(ref ulong, ref uint, ref ulong, ref const(TypeInfo)) () at /usr/lib/libdruntime-ldc-shared.so.94
#5  0x00007ffff71ca503 in _DThn16_2gc4impl12conservativeQw14ConservativeGC6qallocMFNbmkxC8TypeInfoZS4core6memory8BlkInfo_ () at /usr/lib/libdruntime-ldc-shared.so.94
#6  0x00007ffff71d28b0 in gc_qalloc () at /usr/lib/libdruntime-ldc-shared.so.94
#7  0x00007ffff71ba872 in core.memory.GC.qalloc(ulong, uint, const(TypeInfo)) () at /usr/lib/libdruntime-ldc-shared.so.94
#8  0x00007ffff71e236e in _d_newarrayU () at /usr/lib/libdruntime-ldc-shared.so.94
#9  0x000055555570924c in std.array.arrayAllocImpl!(false, char[], ulong).arrayAllocImpl(ulong) ()
#10 0x00005555557091c5 in std.array.uninitializedArray!(char[], ulong).uninitializedArray(ulong) ()
#11 0x00005555557267cc in std.array.join!(immutable(char)[][], immutable(char)[]).join(immutable(char)[][], scope immutable(char)[]).__lambda3() ()
#12 0x000055555571d77e in std.array.join!(immutable(char)[][], immutable(char)[]).join(immutable(char)[][], scope immutable(char)[]) ()
#13 0x000055555571cf3c in asgen.contentsstore.ContentsStore.addContents(immutable(char)[], immutable(char)[][]) ()
#14 0x000055555575ca9d in asgen.engine.Engine.seedContentsData(asgen.config.Suite, immutable(char)[], immutable(char)[], asgen.backends.interfaces.Package[]).__foreachbody7(ref asgen.backends.interfaces.Package) ()
#15 0x00005555557646dd in std.parallelism.ParallelForeach!(asgen.backends.interfaces.Package[]).ParallelForeach.opApply(scope int(ref asgen.backends.interfaces.Package) delegate).doIt() ()
#16 0x00007ffff750f6a0 in std.parallelism.TaskPool.executeWorkLoop() () at /usr/lib/libphobos2-ldc-shared.so.94
#17 0x00007ffff71c0aaa in thread_entryPoint () at /usr/lib/libdruntime-ldc-shared.so.94
#18 0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#19 0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 13 (Thread 0x7fdfd27fc640 (LWP 5777) "appstream-gener"):
#0  0x00007ffff70f8db0 in __lll_lock_wait () at /usr/lib/libpthread.so.0
#1  0x00007ffff70f17d1 in pthread_mutex_lock () at /usr/lib/libpthread.so.0
#2  0x00007ffff71e9021 in _d_monitorenter () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x000055555571cf55 in asgen.contentsstore.ContentsStore.addContents(immutable(char)[], immutable(char)[][]) ()
#4  0x000055555575ca9d in asgen.engine.Engine.seedContentsData(asgen.config.Suite, immutable(char)[], immutable(char)[], asgen.backends.interfaces.Package[]).__foreachbody7(ref asgen.backends.interfaces.Package) ()
#5  0x00005555557646dd in std.parallelism.ParallelForeach!(asgen.backends.interfaces.Package[]).ParallelForeach.opApply(scope int(ref asgen.backends.interfaces.Package) delegate).doIt() ()
#6  0x00007ffff750f6a0 in std.parallelism.TaskPool.executeWorkLoop() () at /usr/lib/libphobos2-ldc-shared.so.94
#7  0x00007ffff71c0aaa in thread_entryPoint () at /usr/lib/libdruntime-ldc-shared.so.94
#8  0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#9  0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 12 (Thread 0x7fdfd2ffd640 (LWP 5776) "appstream-gener"):
#0  0x00007ffff70f8db0 in __lll_lock_wait () at /usr/lib/libpthread.so.0
#1  0x00007ffff70f17d1 in pthread_mutex_lock () at /usr/lib/libpthread.so.0
#2  0x00007ffff71e9021 in _d_monitorenter () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x000055555571cf55 in asgen.contentsstore.ContentsStore.addContents(immutable(char)[], immutable(char)[][]) ()
#4  0x000055555575ca9d in asgen.engine.Engine.seedContentsData(asgen.config.Suite, immutable(char)[], immutable(char)[], asgen.backends.interfaces.Package[]).__foreachbody7(ref asgen.backends.interfaces.Package) ()
#5  0x00005555557646dd in std.parallelism.ParallelForeach!(asgen.backends.interfaces.Package[]).ParallelForeach.opApply(scope int(ref asgen.backends.interfaces.Package) delegate).doIt() ()
#6  0x00007ffff750f6a0 in std.parallelism.TaskPool.executeWorkLoop() () at /usr/lib/libphobos2-ldc-shared.so.94
#7  0x00007ffff71c0aaa in thread_entryPoint () at /usr/lib/libdruntime-ldc-shared.so.94
#8  0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#9  0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 11 (Thread 0x7fdfd37fe640 (LWP 5775) "appstream-gener"):
#0  0x00007ffff6e84c51 in clock_nanosleep@GLIBC_2.2.5 () at /usr/lib/libc.so.6
#1  0x00007ffff6e8a137 in nanosleep () at /usr/lib/libc.so.6
#2  0x00007ffff71c1249 in core.thread.osthread.Thread.sleep(core.time.Duration) () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x00007ffff71b7eb2 in core.internal.spinlock.SpinLock.lock() shared () at /usr/lib/libdruntime-ldc-shared.so.94
#4  0x00007ffff71c7690 in gc.impl.conservative.gc.ConservativeGC.runLocked!(gc.impl.conservative.gc.ConservativeGC.mallocNoSync(ulong, uint, ref ulong, const(TypeInfo)), gc.impl.conservative.gc.mallocTime, gc.impl.conservative.gc.numMallocs, ulong, uint, ulong, const(TypeInfo)).runLocked(ref ulong, ref uint, ref ulong, ref const(TypeInfo)) () at /usr/lib/libdruntime-ldc-shared.so.94
#5  0x00007ffff71ca503 in _DThn16_2gc4impl12conservativeQw14ConservativeGC6qallocMFNbmkxC8TypeInfoZS4core6memory8BlkInfo_ () at /usr/lib/libdruntime-ldc-shared.so.94
#6  0x00007ffff71d28b0 in gc_qalloc () at /usr/lib/libdruntime-ldc-shared.so.94
#7  0x00007ffff71ba872 in core.memory.GC.qalloc(ulong, uint, const(TypeInfo)) () at /usr/lib/libdruntime-ldc-shared.so.94
#8  0x00007ffff71e236e in _d_newarrayU () at /usr/lib/libdruntime-ldc-shared.so.94
#9  0x00007ffff71e2576 in _d_newarrayiT () at /usr/lib/libdruntime-ldc-shared.so.94
#10 0x00007ffff754cf66 in std.string.toStringz(scope return immutable(char)[]) () at /usr/lib/libphobos2-ldc-shared.so.94
#11 0x0000555555735b68 in asgen.datastore.DataStore.makeDbValue(immutable(char)[]) ()
#12 0x0000555555735caf in asgen.datastore.DataStore.putKeyValue(uint, immutable(char)[], immutable(char)[]) ()
#13 0x0000555555736308 in asgen.datastore.DataStore.setPackageIgnore(immutable(char)[]) ()
#14 0x000055555575cacd in asgen.engine.Engine.seedContentsData(asgen.config.Suite, immutable(char)[], immutable(char)[], asgen.backends.interfaces.Package[]).__foreachbody7(ref asgen.backends.interfaces.Package) ()
#15 0x00005555557646dd in std.parallelism.ParallelForeach!(asgen.backends.interfaces.Package[]).ParallelForeach.opApply(scope int(ref asgen.backends.interfaces.Package) delegate).doIt() ()
#16 0x00007ffff750f6a0 in std.parallelism.TaskPool.executeWorkLoop() () at /usr/lib/libphobos2-ldc-shared.so.94
#17 0x00007ffff71c0aaa in thread_entryPoint () at /usr/lib/libdruntime-ldc-shared.so.94
#18 0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#19 0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 10 (Thread 0x7fdfd3fff640 (LWP 5774) "appstream-gener"):
#0  0x00007ffff70f8db0 in __lll_lock_wait () at /usr/lib/libpthread.so.0
#1  0x00007ffff70f17d1 in pthread_mutex_lock () at /usr/lib/libpthread.so.0
#2  0x00007ffff71e9021 in _d_monitorenter () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x000055555571cf55 in asgen.contentsstore.ContentsStore.addContents(immutable(char)[], immutable(char)[][]) ()
#4  0x000055555575ca9d in asgen.engine.Engine.seedContentsData(asgen.config.Suite, immutable(char)[], immutable(char)[], asgen.backends.interfaces.Package[]).__foreachbody7(ref asgen.backends.interfaces.Package) ()
#5  0x00005555557646dd in std.parallelism.ParallelForeach!(asgen.backends.interfaces.Package[]).ParallelForeach.opApply(scope int(ref asgen.backends.interfaces.Package) delegate).doIt() ()
#6  0x00007ffff750f6a0 in std.parallelism.TaskPool.executeWorkLoop() () at /usr/lib/libphobos2-ldc-shared.so.94
#7  0x00007ffff71c0aaa in thread_entryPoint () at /usr/lib/libdruntime-ldc-shared.so.94
#8  0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#9  0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 9 (Thread 0x7fdff099f640 (LWP 5773) "appstream-gener"):
#0  0x00007ffff70f8014 in do_futex_wait.constprop () at /usr/lib/libpthread.so.0
#1  0x00007ffff70f8118 in __new_sem_wait_slow.constprop.0 () at /usr/lib/libpthread.so.0
#2  0x00007ffff71c16f3 in thread_suspendAll () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x00007ffff71c97ed in gc.impl.conservative.gc.Gcx.fullcollect(bool) () at /usr/lib/libdruntime-ldc-shared.so.94
#4  0x00007ffff71cbf0f in gc.impl.conservative.gc.Gcx.bigAlloc(ulong, ref ulong, uint, const(TypeInfo)) () at /usr/lib/libdruntime-ldc-shared.so.94
#5  0x00007ffff71c76ba in gc.impl.conservative.gc.ConservativeGC.runLocked!(gc.impl.conservative.gc.ConservativeGC.mallocNoSync(ulong, uint, ref ulong, const(TypeInfo)), gc.impl.conservative.gc.mallocTime, gc.impl.conservative.gc.numMallocs, ulong, uint, ulong, const(TypeInfo)).runLocked(ref ulong, ref uint, ref ulong, ref const(TypeInfo)) () at /usr/lib/libdruntime-ldc-shared.so.94
#6  0x00007ffff71ca503 in _DThn16_2gc4impl12conservativeQw14ConservativeGC6qallocMFNbmkxC8TypeInfoZS4core6memory8BlkInfo_ () at /usr/lib/libdruntime-ldc-shared.so.94
#7  0x00007ffff71d28b0 in gc_qalloc () at /usr/lib/libdruntime-ldc-shared.so.94
#8  0x00007ffff71ba872 in core.memory.GC.qalloc(ulong, uint, const(TypeInfo)) () at /usr/lib/libdruntime-ldc-shared.so.94
#9  0x00007ffff71e236e in _d_newarrayU () at /usr/lib/libdruntime-ldc-shared.so.94
#10 0x000055555570924c in std.array.arrayAllocImpl!(false, char[], ulong).arrayAllocImpl(ulong) ()
#11 0x00005555557091c5 in std.array.uninitializedArray!(char[], ulong).uninitializedArray(ulong) ()
#12 0x00005555557267cc in std.array.join!(immutable(char)[][], immutable(char)[]).join(immutable(char)[][], scope immutable(char)[]).__lambda3() ()
#13 0x000055555571d77e in std.array.join!(immutable(char)[][], immutable(char)[]).join(immutable(char)[][], scope immutable(char)[]) ()
#14 0x000055555571cf3c in asgen.contentsstore.ContentsStore.addContents(immutable(char)[], immutable(char)[][]) ()
#15 0x000055555575ca9d in asgen.engine.Engine.seedContentsData(asgen.config.Suite, immutable(char)[], immutable(char)[], asgen.backends.interfaces.Package[]).__foreachbody7(ref asgen.backends.interfaces.Package) ()
#16 0x00005555557646dd in std.parallelism.ParallelForeach!(asgen.backends.interfaces.Package[]).ParallelForeach.opApply(scope int(ref asgen.backends.interfaces.Package) delegate).doIt() ()
#17 0x00007ffff750f6a0 in std.parallelism.TaskPool.executeWorkLoop() () at /usr/lib/libphobos2-ldc-shared.so.94
#18 0x00007ffff71c0aaa in thread_entryPoint () at /usr/lib/libdruntime-ldc-shared.so.94
#19 0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#20 0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 8 (Thread 0x7ffff6d84640 (LWP 5772) "appstream-gener"):
#0  0x00007ffff70f56a2 in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0
#1  0x00007ffff71be6c8 in core.sync.event.Event.wait(core.time.Duration) () at /usr/lib/libdruntime-ldc-shared.so.94
#2  0x00007ffff71cf901 in gc.impl.conservative.gc.Gcx.scanBackground() () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x00007ffff71c1ba6 in core.thread.osthread.createLowLevelThread(void() nothrow delegate, uint, void() nothrow delegate).thread_lowlevelEntry(void*) () at /usr/lib/libdruntime-ldc-shared.so.94
#4  0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#5  0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 7 (Thread 0x7ffff6d8a640 (LWP 5771) "appstream-gener"):
#0  0x00007ffff70f56a2 in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0
#1  0x00007ffff71be6c8 in core.sync.event.Event.wait(core.time.Duration) () at /usr/lib/libdruntime-ldc-shared.so.94
#2  0x00007ffff71cf901 in gc.impl.conservative.gc.Gcx.scanBackground() () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x00007ffff71c1ba6 in core.thread.osthread.createLowLevelThread(void() nothrow delegate, uint, void() nothrow delegate).thread_lowlevelEntry(void*) () at /usr/lib/libdruntime-ldc-shared.so.94
#4  0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#5  0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 6 (Thread 0x7ffff6d90640 (LWP 5770) "appstream-gener"):
#0  0x00007ffff70f56a2 in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0
#1  0x00007ffff71be6c8 in core.sync.event.Event.wait(core.time.Duration) () at /usr/lib/libdruntime-ldc-shared.so.94
#2  0x00007ffff71cf901 in gc.impl.conservative.gc.Gcx.scanBackground() () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x00007ffff71c1ba6 in core.thread.osthread.createLowLevelThread(void() nothrow delegate, uint, void() nothrow delegate).thread_lowlevelEntry(void*) () at /usr/lib/libdruntime-ldc-shared.so.94
#4  0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#5  0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 5 (Thread 0x7ffff6d96640 (LWP 5769) "appstream-gener"):
#0  0x00007ffff70f56a2 in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0
#1  0x00007ffff71be6c8 in core.sync.event.Event.wait(core.time.Duration) () at /usr/lib/libdruntime-ldc-shared.so.94
#2  0x00007ffff71cf901 in gc.impl.conservative.gc.Gcx.scanBackground() () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x00007ffff71c1ba6 in core.thread.osthread.createLowLevelThread(void() nothrow delegate, uint, void() nothrow delegate).thread_lowlevelEntry(void*) () at /usr/lib/libdruntime-ldc-shared.so.94
#4  0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#5  0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 4 (Thread 0x7ffff6d9c640 (LWP 5768) "appstream-gener"):
#0  0x00007ffff70f56a2 in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0
#1  0x00007ffff71be6c8 in core.sync.event.Event.wait(core.time.Duration) () at /usr/lib/libdruntime-ldc-shared.so.94
#2  0x00007ffff71cf901 in gc.impl.conservative.gc.Gcx.scanBackground() () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x00007ffff71c1ba6 in core.thread.osthread.createLowLevelThread(void() nothrow delegate, uint, void() nothrow delegate).thread_lowlevelEntry(void*) () at /usr/lib/libdruntime-ldc-shared.so.94
#4  0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#5  0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 3 (Thread 0x7ffff6da2640 (LWP 5767) "appstream-gener"):
#0  0x00007ffff70f56a2 in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0
#1  0x00007ffff71be6c8 in core.sync.event.Event.wait(core.time.Duration) () at /usr/lib/libdruntime-ldc-shared.so.94
#2  0x00007ffff71cf901 in gc.impl.conservative.gc.Gcx.scanBackground() () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x00007ffff71c1ba6 in core.thread.osthread.createLowLevelThread(void() nothrow delegate, uint, void() nothrow delegate).thread_lowlevelEntry(void*) () at /usr/lib/libdruntime-ldc-shared.so.94
#4  0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#5  0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 2 (Thread 0x7ffff6da8640 (LWP 5766) "appstream-gener"):
#0  0x00007ffff70f56a2 in pthread_cond_wait@@GLIBC_2.3.2 () at /usr/lib/libpthread.so.0
#1  0x00007ffff71be6c8 in core.sync.event.Event.wait(core.time.Duration) () at /usr/lib/libdruntime-ldc-shared.so.94
#2  0x00007ffff71cf901 in gc.impl.conservative.gc.Gcx.scanBackground() () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x00007ffff71c1ba6 in core.thread.osthread.createLowLevelThread(void() nothrow delegate, uint, void() nothrow delegate).thread_lowlevelEntry(void*) () at /usr/lib/libdruntime-ldc-shared.so.94
#4  0x00007ffff70ef3e9 in start_thread () at /usr/lib/libpthread.so.0
#5  0x00007ffff6ebd293 in clone () at /usr/lib/libc.so.6

Thread 1 (Thread 0x7ffff32b7bc0 (LWP 5762) "appstream-gener"):
#0  0x00007ffff6e84c51 in clock_nanosleep@GLIBC_2.2.5 () at /usr/lib/libc.so.6
#1  0x00007ffff6e8a137 in nanosleep () at /usr/lib/libc.so.6
#2  0x00007ffff71c1249 in core.thread.osthread.Thread.sleep(core.time.Duration) () at /usr/lib/libdruntime-ldc-shared.so.94
#3  0x00007ffff71b7eb2 in core.internal.spinlock.SpinLock.lock() shared () at /usr/lib/libdruntime-ldc-shared.so.94
#4  0x00007ffff71c7690 in gc.impl.conservative.gc.ConservativeGC.runLocked!(gc.impl.conservative.gc.ConservativeGC.mallocNoSync(ulong, uint, ref ulong, const(TypeInfo)), gc.impl.conservative.gc.mallocTime, gc.impl.conservative.gc.numMallocs, ulong, uint, ulong, const(TypeInfo)).runLocked(ref ulong, ref uint, ref ulong, ref const(TypeInfo)) () at /usr/lib/libdruntime-ldc-shared.so.94
#5  0x00007ffff71ca503 in _DThn16_2gc4impl12conservativeQw14ConservativeGC6qallocMFNbmkxC8TypeInfoZS4core6memory8BlkInfo_ () at /usr/lib/libdruntime-ldc-shared.so.94
#6  0x00007ffff71d28b0 in gc_qalloc () at /usr/lib/libdruntime-ldc-shared.so.94
#7  0x00007ffff71ba872 in core.memory.GC.qalloc(ulong, uint, const(TypeInfo)) () at /usr/lib/libdruntime-ldc-shared.so.94
#8  0x00007ffff71e236e in _d_newarrayU () at /usr/lib/libdruntime-ldc-shared.so.94
#9  0x00007ffff71e2576 in _d_newarrayiT () at /usr/lib/libdruntime-ldc-shared.so.94
#10 0x00007ffff754cf66 in std.string.toStringz(scope return immutable(char)[]) () at /usr/lib/libphobos2-ldc-shared.so.94
#11 0x000055555571c8c8 in asgen.contentsstore.ContentsStore.makeDbValue(immutable(char)[]) ()
#12 0x000055555571cf77 in asgen.contentsstore.ContentsStore.addContents(immutable(char)[], immutable(char)[][]) ()
#13 0x000055555575ca9d in asgen.engine.Engine.seedContentsData(asgen.config.Suite, immutable(char)[], immutable(char)[], asgen.backends.interfaces.Package[]).__foreachbody7(ref asgen.backends.interfaces.Package) ()
#14 0x00005555557646dd in std.parallelism.ParallelForeach!(asgen.backends.interfaces.Package[]).ParallelForeach.opApply(scope int(ref asgen.backends.interfaces.Package) delegate).doIt() ()
#15 0x00007ffff7510937 in std.parallelism.submitAndExecute(std.parallelism.TaskPool, scope void() delegate) () at /usr/lib/libphobos2-ldc-shared.so.94
#16 0x000055555575c143 in std.parallelism.ParallelForeach!(asgen.backends.interfaces.Package[]).ParallelForeach.opApply(scope int(ref asgen.backends.interfaces.Package) delegate) ()
#17 0x000055555575c615 in asgen.engine.Engine.seedContentsData(asgen.config.Suite, immutable(char)[], immutable(char)[], asgen.backends.interfaces.Package[]) ()
#18 0x0000555555760335 in asgen.engine.Engine.processSuiteSection(asgen.config.Suite, const(immutable(char)[]), asgen.reportgenerator.ReportGenerator) ()
#19 0x0000555555761bd6 in asgen.engine.Engine.run(immutable(char)[]) ()
#20 0x00005555556ea06b in D main ()

@ximion
Copy link
Owner

ximion commented Jan 24, 2021

This backtrace looks a bit like it is hanging in a GC collection cycle... Otherwise I can't explain why a GC allocation would be blocking in a mutex'ed version of the code (the trace misses debug symbols though, so maybe that causes it...)
Which version of LDC are you using? I upgraded LMDB and at least with my testcases that didn't make a difference - I'll try your test data next.

@ximion ximion added the bug label Jan 24, 2021
@ximion ximion self-assigned this Jan 24, 2021
@ximion
Copy link
Owner

ximion commented Jan 24, 2021

Okay, now I can reproduce the issue with your testcase 100% of the time.
It looks like this change in lmdb broke it, which is a bit crazy:
https://git.openldap.org/openldap/openldap/-/commit/f683ffdc81d0edb20437cb7d655cf15a60e31249 - now I need to figure out why this change breaks the generator.

@ximion ximion closed this as completed in c4cfd00 Jan 24, 2021
@ximion
Copy link
Owner

ximion commented Jan 24, 2021

@antonio-rojas Could you test this patch? Works fine for me (and this behavior of LMDB was really strange... But fortunately not difficult to work around).

@antonio-rojas
Copy link
Contributor

Yes, this fixes both the crashes and the hang on my new laptop

ximion added a commit that referenced this issue Jan 24, 2021
With the only-one-simultaneous-DB-env-open-per-thread behavior change,
using the NOTLS option no longer appears to be necessary.

CC: #85
@ximion
Copy link
Owner

ximion commented Jan 24, 2021

Nice! Thank you a lot for your help, without your minimal testcase I would not have been able to find this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants