segfault on gc.impl.conservative.gc.Gcx.smallAlloc

drug drug2004 at bk.ru
Tue Sep 26 17:06:28 UTC 2017


26.09.2017 00:34, Mengu пишет:
> hi all
> 
> this following code block [0] is exiting with "terminated by signal 
> SIGBUS (Misaligned address error)" error. it processes like 200K rows 
> and then fails. any ideas?
> 
> void getHotels() {
>    import std.parallelism : taskPool;
>    import std.functional  : partial;
> 
>    auto sunHotels         = new SunHotels();
>    auto destinations      = sunHotels.parseDestinations();
>    auto conn              = client.lockConnection();
>    auto destinationResult = conn.execStatement("SELECT provider_ref, id 
> FROM hotels_destination", ValueFormat.BINARY);
>    int[int] destinationIds;
> 
>    foreach (row; rangify(destinationResult)) {
>      destinationIds[row["provider_ref"].as!PGinteger] = 
> row["id"].as!PGinteger;
>    }
> 
>    foreach (destination; parallel(destinations)) {
>      const string destId = to!string(destination.destinationId);
>      const auto destinationFilePath = getcwd() ~ "/ext/data/hotels/" ~ 
> destId ~ ".xml";
>      auto xmlFile = new MmFile(destinationFilePath);
>      auto fileContents = cast(string)xmlFile[0..xmlFile.length];
>      auto hotels = sunHotels.parseHotelsResult(fileContents);
>      const destIdInDb = destinationIds[destination.destinationId];
>      auto sqls = appender!string;
>      writeln("parsing destination: ", destination.destinationName);
> 
>      foreach (hotel; parallel(hotels)) {
>          sqls.put(hotel.generateSql(destIdInDb).data.join);
>      }
> 
>      sqls.data.writeln;
> 
> 
>      delete fileContents;
>      delete xmlFile;
>    }
> 
> }
> 
> this is the full trace i got [1]:
> 
> #0  0x0000000000bef5ef in gc.impl.conservative.gc.Gcx.smallAlloc(ubyte, 
> ref ulong, uint) ()
> [Current thread is 1 (LWP 100171)]
> (gdb) bt full
> #0  0x0000000000bef5ef in gc.impl.conservative.gc.Gcx.smallAlloc(ubyte, 
> ref ulong, uint) ()
> No symbol table info available.
> #1  0x0000000000bf3925 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)) ()
> No symbol table info available.
> #2  0x0000000000bed103 in 
> gc.impl.conservative.gc.ConservativeGC.qalloc(ulong, uint, 
> const(TypeInfo)) ()
> No symbol table info available.
> #3  0x0000000000b9c6e3 in gc_qalloc ()
> No symbol table info available.
> #4  0x0000000000b96140 in core.memory.GC.qalloc(ulong, uint, 
> const(TypeInfo)) ()
> No symbol table info available.
> #5  0x000000000093fdce in 
> std.array.Appender!(immutable(char)[]).Appender.ensureAddable(ulong) 
> (this=..., nelems=761)
>      at 
> /home/search-master/dmd2/freebsd/bin64/../../src/phobos/std/array.d:2929
>          len = 394
>          reqlen = 1155
>          newlen = 1155
>          u = 0
>          overflow = false
>          nbytes = 1155
>          bi = {base = 0x2b1, size = 140737488337376, attr = 4294949280}
> #6  0x0000000000942c0f in 
> std.array.Appender!(immutable(char)[]).Appender.put!(immutable(char)[]).put(immutable(char)[]).bigDataFun(ulong) 
> (
>      this=0x7fffffffb9f0, extra=761)
>      at 
> /home/search-master/dmd2/freebsd/bin64/../../src/phobos/std/array.d:3023
> No locals.
> #7  0x0000000000942b55 in 
> std.array.Appender!(immutable(char)[]).Appender.put!(immutable(char)[]).put(immutable(char)[]) 
> (this=...,
> ---Type <return> to continue, or q <return> to quit---
>       at 
> /home/search-master/dmd2/freebsd/bin64/../../src/phobos/std/array.d:3026
>          bigData = "'"
>          len = 760
>          newlen = 34799909888


not big deal probably, but isn't ~32GB enormous value here? I would 
check why bigDataFun return this.




More information about the Digitalmars-d-learn mailing list