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

InvalidMemoryOperation on mongo queries #107

Closed
gedaiu opened this issue Nov 25, 2018 · 7 comments
Closed

InvalidMemoryOperation on mongo queries #107

gedaiu opened this issue Nov 25, 2018 · 7 comments

Comments

@gedaiu
Copy link
Contributor

gedaiu commented Nov 25, 2018

I get the following error almost every time when I start m app. I tried to reduce the code to a small example, but I cound not find the main problem:

creating new MongoConnection connection, all 1 are in use
Create new mongo connection
Thread exit  (index 1) (main=false)
 ... 7FE3254A9C00
Now got 2 connections
Path 'users/me' -> 'users/me'
Path 'users/me' -> 'users/me'
creating new MongoConnection connection, all 2 are in use
Create new mongo connection
core.exception.InvalidMemoryOperationError@src/core/exception.d(700): Invalid memory operation
----------------
Program exited with code -6
@s-ludwig
Copy link
Member

Usually setting a breakpoint at _onInvalidMemoryOperation gives a proper call stack, so that would be something to try out. Otherwise, could it be that a query with a long result list is involved (where the result is returned in multiple chunks)? That is something that broke with the cursor refactoring a while ago and which, I think, is also hitting the DUB registry when searching for single letters.

@gedaiu
Copy link
Contributor Author

gedaiu commented Nov 26, 2018

I don't have that symbol... I'm building with the latest dmd on linux. Do I need any special setup?

Function "_onInvalidMemoryOperation" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (_onInvalidMemoryOperation) pending.
(gdb) r
Starting program: /home/gedaiu/workspace/ogm-server/ogm_server 
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.28-17.fc29.x86_64
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
[main(----) INF] Starting `ogm-server` v0.1.0
[main(----) INF] configured with `config/configuration.json`
[Detaching after fork from child process 16911]
[main(----) INF] Recovering from unexpected stop
[main(----) INF] create
[New Thread 0x7ffff6583700 (LWP 16912)]
[Thread 0x7ffff6583700 (LWP 16912) exited]
[main(----) INF] The country `unknown` already exist.
[main(----) INF] Listening for requests on http://[::]:9091/
Failed to listen on 0.0.0.0:9091
[main(IVrS) INF] create
[New Thread 0x7ffff4d81700 (LWP 16946)]
[Thread 0x7ffff4d81700 (LWP 16946) exited]
core.exception.InvalidMemoryOperationError@src/core/exception.d(700): Invalid memory operation
----------------

Thread 1 "ogm_server" received signal SIGABRT, Aborted.
0x00007ffff755653f in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: dnf debuginfo-install ImageMagick-libs-6.9.9.38-3.fc29.x86_64 bzip2-libs-1.0.6-28.fc29.x86_64 compat-openssl10-1.0.2o-3.fc29.x86_64 expat-2.2.6-1.fc29.x86_64 fftw-libs-double-3.3.8-2.fc29.x86_64 fontconfig-2.13.1-3.fc29.x86_64 freetype-2.9.1-6.fc29.x86_64 lcms2-2.9-4.fc29.x86_64 libICE-1.0.9-14.fc29.x86_64 libSM-1.2.3-1.fc29.x86_64 libX11-1.6.7-1.fc29.x86_64 libXext-1.3.3-10.fc29.x86_64 libXt-1.1.5-9.fc29.x86_64 libgcc-8.2.1-5.fc29.x86_64 libgomp-8.2.1-5.fc29.x86_64 libpng-1.6.34-6.fc29.x86_64 libtool-ltdl-2.4.6-27.fc29.x86_64 libuuid-2.32.1-1.fc29.x86_64 libxcb-1.13.1-1.fc29.x86_64 xz-libs-5.2.4-3.fc29.x86_64 zlib-1.2.11-14.fc29.x86_64
(gdb) bt
#0  0x00007ffff755653f in raise () from /lib64/libc.so.6
#1  0x00007ffff7540895 in abort () from /lib64/libc.so.6
#2  0x0000000000da65ca in vibe.core.task.TaskFiber.run() (this=0x7ffff6c90800) at ../../.dub/packages/vibe-core-1.4.5/vibe-core/source/vibe/core/task.d:435
#3  0x0000000000e6f000 in core.thread.Fiber.run() ()
#4  0x0000000000e6eecf in fiber_entryPoint ()
#5  0x0000000000000000 in ?? ()
(gdb) 
(lldb) br s -M _onInvalidMemoryOperation
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
(lldb) r
Process 17315 launched: '/home/gedaiu/workspace/ogm-server/ogm_server' (x86_64)
[main(----) INF] Starting `ogm-server` v0.1.0
[main(----) INF] configured with `config/configuration.json`
Process 17315 stopped and restarted: thread 1 received signal: SIGCHLD
[main(----) INF] Recovering from unexpected stop
[main(----) INF] create
[main(----) INF] The country `unknown` already exist.
[main(----) INF] Listening for requests on http://[::]:9091/
Failed to listen on 0.0.0.0:9091
[main(IVrS) INF] create
core.exception.InvalidMemoryOperationError@src/core/exception.d(700): Invalid memory operation
----------------
Process 17315 stopped
* thread #1, name = 'ogm_server', stop reason = signal SIGABRT
    frame #0: 0x00007ffff755653f libc.so.6`.annobin_raise.c + 271
libc.so.6`.annobin_raise.c:
->  0x7ffff755653f <+271>: movq   0x108(%rsp), %rcx
    0x7ffff7556547 <+279>: xorq   %fs:0x28, %rcx
    0x7ffff7556550 <+288>: movl   %r8d, %eax
    0x7ffff7556553 <+291>: jne    0x7ffff755656e            ; <+318>
(lldb) bt
* thread #1, name = 'ogm_server', stop reason = signal SIGABRT
  * frame #0: 0x00007ffff755653f libc.so.6`.annobin_raise.c + 271
    frame #1: 0x00007ffff7540895 libc.so.6`__GI_abort + 295
    frame #2: 0x0000000000da65ca ogm_server`_D4vibe4core4task9TaskFiber3runMFNbZv(this=0x00007ffff6c90a00) at task.d:435
    frame #3: 0x0000000000e6f000 ogm_server`_D4core6thread5Fiber3runMFZv + 44
    frame #4: 0x0000000000e6eecf ogm_server`fiber_entryPoint + 103
(lldb) 

@s-ludwig
Copy link
Member

Ah, sorry, that should be onInvalidMemoryOperationError.

@gedaiu
Copy link
Contributor Author

gedaiu commented Nov 26, 2018

awesome! thanks... I have a stack now. I'll try to give some time to this issue.

#0  0x0000000000ea3a1c in onInvalidMemoryOperationError ()
#1  0x0000000000e76719 in _D2gc4impl12conservativeQw14ConservativeGC__T9runLockedS_DQCeQCeQCcQCnQBs12mallocNoSyncMFNbmkKmxC8TypeInfoZPvS_DQEgQEgQEeQEp10mallocTimelS_DQFiQFiQFgQFr10numMallocslTmTkTmTxQCzZQFcMFNbKmKkKmKxQDsZQDl ()
#2  0x0000000000e701aa in _D2gc4impl12conservativeQw14ConservativeGC6mallocMFNbmkxC8TypeInfoZPv ()
#3  0x0000000000e17747 in gc_malloc ()
#4  0x0000000000e1a88e in _d_newclass ()
#5  0x0000000000c7d100 in _D4vibe2db5mongo6client11MongoClient6__ctorMFNfCQBuQBsQBs8settings19MongoClientSettingsZ9__lambda2MFNfZCQDyQDwQDw10connection15MongoConnection (this=0x7ffff6c1a4f0) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/mongodb/vibe/db/mongo/client.d:80
#6  0x0000000000c7d5e2 in _D4vibe4core14connectionpool__T14ConnectionPoolTCQBv2db5mongo10connection15MongoConnectionZQCi14lockConnectionMFNfZSQEkQEiQEg__T16LockedConnectionTQDvZQx (this=0x7ffff6c19c80, ret=0x7fffeeffbb38) at ../../.dub/packages/vibe-core-1.4.5/vibe-core/source/vibe/core/connectionpool.d:92
#7  0x0000000000c7d24d in _D4vibe2db5mongo6client11MongoClient14lockConnectionMFNfZSQCe4core14connectionpool__T16LockedConnectionTCQDzQDxQDx10connection15MongoConnectionZQCh (this=0x7ffff6c1b900, __HID3=0x7fffeeffbb38) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/mongodb/vibe/db/mongo/client.d:161
#8  0x0000000000bc2dc9 in _D4vibe2db5mongo6cursor__T15MongoCursorDataTSQBr4data4json4JsonZQBm7destroyMFNfZv (this=0x7fffe9de6a00)
    at ../../.dub/packages/vibe-d-0.8.4/vibe-d/mongodb/vibe/db/mongo/cursor.d:296
#9  0x0000000000bc25d0 in _D4vibe2db5mongo6cursor__T11MongoCursorTSQBn4data4json4JsonZQBi6__dtorMFNfZv (this=...)
    at ../../.dub/packages/vibe-d-0.8.4/vibe-d/mongodb/vibe/db/mongo/cursor.d:51
#10 0x0000000000be425d in crate.collection.mongo.MongoRange.__fieldDtor() (this=0x7fffe9de7a80) at crate/source/crate/collection/mongo.d:19
#11 0x0000000000e1b9bd in rt_finalize2 ()
#12 0x0000000000e7ad82 in rt_finalizeFromGC ()
#13 0x0000000000e74006 in _D2gc4impl12conservativeQw3Gcx5sweepMFNbZm ()
#14 0x0000000000e748db in _D2gc4impl12conservativeQw3Gcx11fullcollectMFNbbZm ()
#15 0x0000000000e7272a in _D2gc4impl12conservativeQw3Gcx10smallAllocMFNbhKmkZPv ()
#16 0x0000000000e76765 in _D2gc4impl12conservativeQw14ConservativeGC__T9runLockedS_DQCeQCeQCcQCnQBs12mallocNoSyncMFNbmkKmxC8TypeInfoZPvS_DQEgQEgQEeQEp10mallocTimelS_DQFiQFiQFgQFr10numMallocslTmTkTmTxQCzZQFcMFNbKmKkKmKxQDsZQDl ()
#17 0x0000000000e702af in _D2gc4impl12conservativeQw14ConservativeGC6qallocMFNbmkxC8TypeInfoZS4core6memory8BlkInfo_ ()
#18 0x0000000000e1777e in gc_qalloc ()
#19 0x0000000000e7a980 in _D2rt8lifetime12__arrayAllocFNaNbmxC8TypeInfoxQlZS4core6memory8BlkInfo_ ()
#20 0x0000000000e1b50e in _d_newarrayU ()
#21 0x0000000000e1b591 in _d_newarrayT ()
#22 0x0000000000dedfaa in _D4vibe4data4bson4Bson6toJsonMxFNfZSQBiQBg4json4Json (this=..., __HID4=0x7fffeeffc7e0)
    at ../../.dub/packages/vibe-d-0.8.4/vibe-d/data/vibe/data/bson.d:508
#23 0x0000000000dede37 in _D4vibe4data4bson4Bson6toJsonMxFNfZSQBiQBg4json4Json (this=..., __HID4=0x7fffeeffceb0)
    at ../../.dub/packages/vibe-d-0.8.4/vibe-d/data/vibe/data/bson.d:505
#24 0x0000000000bc7535 in _D4vibe4data4bson14BsonSerializer__T9readValueTSQBuQBs13serialization__T6TraitsTSQDbQCz4json4JsonSQDsQDqQBy13DefaultPolicyZQBzTQBvZQDrMFNfZQCh (this=..., __HID154=0x7fffeeffceb0) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/data/vibe/data/bson.d:1533
#25 0x0000000000bc7511 in _D4vibe4data13serialization__T20deserializeValueImplTSQCaQBy4bson14BsonSerializerSQDcQDaQCy13DefaultPolicyZ__T23deserializeValueDeducedTSQFfQFd4json4JsonZQBsFNfKQEeZQBd (__HID153=0x7fffeeffceb0, ser=...) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/data/vibe/data/serialization.d:604
#26 0x0000000000bc74f1 in _D4vibe4data13serialization__T20deserializeValueImplTSQCaQBy4bson14BsonSerializerSQDcQDaQCy13DefaultPolicyZ__T16deserializeValueTSQEyQEw4json4JsonZQBlFNfKQDxZQBd (__HID152=0x7fffeeffceb0, ser=...) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/data/vibe/data/serialization.d:576
#27 0x0000000000bc74d1 in _D4vibe4data13serialization__T21deserializeWithPolicyTSQCbQBz4bson14BsonSerializerSQDdQDbQCz13DefaultPolicyTSQEdQEb4json4JsonTSQEvQEtQCu4BsonZQEiFNfQwZQBr (__HID151=0x7fffeeffceb0, _param_0=...) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/data/vibe/data/serialization.d:299
#28 0x0000000000bc7482 in _D4vibe4data13serialization__T11deserializeTSQBrQBp4bson14BsonSerializerTSQCuQCs4json4JsonTSQDmQDkQBv4BsonZQCzFNfQwZQBr (
    __HID150=0x7fffeeffceb0, _param_0=...) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/data/vibe/data/serialization.d:265
#29 0x0000000000bc745a in _D4vibe4data4bson__T15deserializeBsonTSQBlQBj4json4JsonZQBkFNfSQCjQChQCf4BsonZQBo (__HID149=0x7fffeeffceb0, src=...)
    at ../../.dub/packages/vibe-d-0.8.4/vibe-d/data/vibe/data/bson.d:1168
#30 0x0000000000bc316f in _D4vibe2db5mongo10connection15MongoConnection__T9recvReplyTSQCg4data4json4JsonZQBfMFNfiMDFNflEQDoQDmQDm5flags10ReplyFlagsiiZvMDFNfmKQCvZvZi (this=0x7ffff6c1c400, on_doc=..., on_msg=..., reqid=15) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/mongodb/vibe/db/mongo/connection.d:410
#31 0x0000000000bc2ec9 in _D4vibe2db5mongo10connection15MongoConnection__T7getMoreTSQCe4data4json4JsonZQBdMFNfAyailMDFNflEQDqQDoQDo5flags10ReplyFlagsiiZvMDFNfmKQCzZvZv (this=0x7ffff6c1c400, on_doc=..., on_msg=..., cursor_id=98208461007, nret=0, collection_name=...) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/mongodb/vibe/db/mongo/connection.d:262
#32 0x0000000000bc296a in _D4vibe2db5mongo6cursor__T15MongoCursorDataTSQBr4data4json4JsonZQBm5emptyMFNdNfZb (this=0x7fffe9dab600) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/mongodb/vibe/db/mongo/cursor.d:244
#33 0x0000000000bc25f8 in _D4vibe2db5mongo6cursor__T11MongoCursorTSQBn4data4json4JsonZQBi5emptyMFNdNfZb (this=...) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/mongodb/vibe/db/mongo/cursor.d:60
#34 0x0000000000be40e5 in crate.collection.mongo.MongoRange.empty() (this=0x7fffe9dac3e0) at crate/source/crate/collection/mongo.d:41
#35 0x0000000000b83bba in _D3std9algorithm9iteration__T9MapResultS3ogm3api6filter4site25SiteSubsetTransformFilter3getMFC4vibe4http6server17HTTPServerRequestC5crate4base6IQueryZ9__lambda3TCQGe5range10interfaces__T10InputRangeTSQEc4data4json4JsonZQBhZQHm5emptyMFNdZb (this=...) at /usr/include/dmd/phobos/std/algorithm/iteration.d:592
#36 0x0000000000b73e01 in _D3std5range10interfaces__T16InputRangeObjectTSQBt9algorithm9iteration__T9MapResultS3ogm3api6filter4site25SiteSubsetTransformFilter3getMFC4vibe4http6server17HTTPServerRequestC5crate4base6IQueryZ9__lambda3TCQHwQHvQHs__T10InputRangeTSQDq4data4json4JsonZQBhZQHaZQIy5emptyMFNdZb (this=0x7fffe9dad100) at /usr/include/dmd/phobos/std/range/interfaces.d:383
#37 0x0000000000be3da0 in _D3std9algorithm9iteration__T12FilterResultS5crate10collection6memory11MemoryQuery4execMFNeZ9__lambda1TCQDy5range10interfaces__T10InputRangeTS4vibe4data4json4JsonZQBjZQFi8popFrontMFZv (this=...) at /usr/include/dmd/phobos/std/algorithm/iteration.d:1365
#38 0x0000000000bf938d in _D3std5range10interfaces__T16InputRangeObjectTSQBt9algorithm9iteration__T12FilterResultS5crate10collection6memory11MemoryQuery4execMFNeZ9__lambda1TCQFqQFpQFm__T10InputRangeTS4vibe4data4json4JsonZQBjZQEwZQGu8popFrontMFZv (this=0x7fffe9dad140) at /usr/include/dmd/phobos/std/range/interfaces.d:382
#39 0x0000000000bcd3c0 in _D3std9algorithm9iteration__T9MapResultS5crate3api4rest10serializer17RestApiSerializer11denormaliseMFNeCQDy5range10interfaces__T10InputRangeTS4vibe4data4json4JsonZQBjZ9__lambda2TQCxZQFx8popFrontMFZv (this=...) at /usr/include/dmd/phobos/std/algorithm/iteration.d:599
#40 0x0000000000bd28ea in _D3std5array__TQjTSQr9algorithm9iteration__T9MapResultS5crate3api4rest10serializer17RestApiSerializer11denormaliseMFNeCQEn5range10interfaces__T10InputRangeTS4vibe4data4json4JsonZQBjZ9__lambda2TQCxZQFxZQHnFQHfZAQCc (r=...) at /usr/include/dmd/phobos/std/array.d:137
#41 0x0000000000bcb845 in _D5crate3api4rest10serializer17RestApiSerializer11denormaliseMFNeC3std5range10interfaces__T10InputRangeTS4vibe4data4json4JsonZQBjZQBa (this=0x7ffff6c81300, result=0x7fffeeffd530, data=0x7fffe9dad150) at crate/source/crate/api/rest/serializer.d:39
#42 0x0000000000ad643d in _D5crate4http8handlers7request__T26requestFilteredListHandlerTSQCj3api4rest6policy7RestApiTS3ogm6models10sitesubset10SiteSubsetTCQEx4auth10middleware20PublicDataMiddlewareTCQDd10moddleware12adminrequest12AdminRequestTCQEwQFz6filter8userData18UserDataMiddlewareTCQGoQHrQBs4site11SitesFilterTCQHrQIuQCvQBd16SiteSubsetFilterTCQIxQKaQEb10searchName16SearchNameFilterTCQKmQLpQFqQDy25SiteSubsetTransformFilterZQOhFxDFNfZCQPx4base6IQueryQLqQKbQIlQGwQFwQEtQDhZ11deserializeMFNeC4vibeQRz6server17HTTPServerRequestCQBjQTgQBh18HTTPServerResponseZv (this=0x7ffff6c0c500, response=0x11b69a0, request=0x11e4b80) at crate/source/crate/http/handlers/request.d:431
#43 0x0000000000bef487 in _D5crate4http8handlers5error19requestErrorHandlerFDFNfC4vibeQCa6server17HTTPServerRequestCQBjQDhQBh18HTTPServerResponseZvZ5checkMFNeQDaQBuZv (this=0x7ffff6c0a600, response=0x11b69a0, request=0x11e4b80) at crate/source/crate/http/handlers/error.d:18
#44 0x0000000000bef03a in _D5crate4http4cors4Cors3addMFE4vibeQBb6common10HTTPMethodDFCQBeQCd6server17HTTPServerRequestCQClQDkQBh18HTTPServerResponseZvZQEiMFQCtQBpZv (this=0x7ffff6c0a6a0, response=0x11b69a0, request=0x11e4b80) at crate/source/crate/http/cors.d:58
#45 0x00000000009e6a31 in _D4vibe4http6router9URLRouter__T15handlerDelegateTDFCQBzQBx6server17HTTPServerRequestCQDgQDeQBh18HTTPServerResponseZvZQDiFNfQCwZ__T9__lambda3TQDmTQCjZQtMFNeQEaQCwZv (this=0x7ffff6c0a6c0, res=0x11b69a0, req=0x11e4b80) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/router.d:274
#46 0x0000000000ca6f48 in _D4vibe4http6router9URLRouter13handleRequestMFNfCQBvQBt6server17HTTPServerRequestCQDcQDaQBh18HTTPServerResponseZ__T9__lambda4TmTAAyaZQsMFNfmMQnZb (this=0x7fffeeffddd8, values=..., ridx=271) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/router.d:218
#47 0x0000000000ca96f6 in _D4vibe4http6router__T9MatchTreeTSQBgQBeQBc5RouteZQBc7doMatchMxFNfAyaMDFNfmMAQlZbZb (this=..., del=..., text=...) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/router.d:674
#48 0x0000000000ca8ff8 in _D4vibe4http6router__T9MatchTreeTSQBgQBeQBc5RouteZQBc5matchMFNfAyaMDFNfmMAQlZbZb (this=..., del=..., text=...) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/router.d:607
#49 0x0000000000ca6c09 in _D4vibe4http6router9URLRouter13handleRequestMFNfCQBvQBt6server17HTTPServerRequestCQDcQDaQBh18HTTPServerResponseZv (this=0x7ffff6c19900, res=0x11b69a0, req=0x11e4b80) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/router.d:211
#50 0x0000000000d1acd4 in _D4vibe4http6server13handleRequestFNfSQBk8internal14interfaceproxy__T14InterfaceProxyTCQDh4core6stream6StreamZQBpSQEiQBb3net13TCPConnectionCQFiQFgQFe17HTTPServerContextKCQGmQGkQGi18HTTPServerSettingsKbMC4stdx9allocator10IAllocatorZb (request_allocator=0x7fffeeffe9d0, keep_alive=@0x7fffeeffec20: true, settings=@0x7fffeeffec18: 0x7ffff6c08500, listen_info=0x7ffff6c87d80, tcp_connection=..., http_stream=...) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/server.d:2247
#51 0x0000000000d19171 in _D4vibe4http6server20handleHTTPConnectionFNfSQBr4core3net13TCPConnectionCQCtQCrQCp17HTTPServerContextZ9__lambda4MFNeZv (this=0x7fffeeffec70) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/server.d:241
#52 0x0000000000d18e80 in _D4vibe4http6server20handleHTTPConnectionFNfSQBr4core3net13TCPConnectionCQCtQCrQCp17HTTPServerContextZv (context=0x7ffff6c87d80, connection=...) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/server.d:242
#53 0x0000000000cb33ee in _D4vibe4http6server15listenHTTPPlainFNfCQBmQBkQBi18HTTPServerSettingsDFNfCQCuQCsQCq17HTTPServerRequestCQDxQDvQDt18HTTPServerResponseZvZ8doListenFNfCQFqQFoQFm17HTTPServerContextbbZ9__lambda4MFNbNfSQHm4core3net13TCPConnectionZv (this=0x7ffff6c0bcc0, conn=...) at ../../.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/server.d:2006
#54 0x0000000000dc6c39 in _D4vibe4core4task12TaskFuncInfo__T3setTDFNfSQBqQBo3net13TCPConnectionZvTQBdZQBqMFKQBrKQBrZ12callDelegateFKSQEbQDzQDxQDvZv (tfi=...) at ../../.dub/packages/vibe-core-1.4.5/vibe-core/source/vibe/core/task.d-mixin-559:559
#55 0x0000000000da6c1e in vibe.core.task.TaskFuncInfo.call() (this=...) at ../../.dub/packages/vibe-core-1.4.5/vibe-core/source/vibe/core/task.d:577
#56 0x0000000000da6226 in vibe.core.task.TaskFiber.run() (this=0x7ffff6c90800) at ../../.dub/packages/vibe-core-1.4.5/vibe-core/source/vibe/core/task.d:388
#57 0x0000000000e6f000 in core.thread.Fiber.run() ()
#58 0x0000000000e6eecf in fiber_entryPoint ()
#59 0x0000000000000000 in ?? ()

@gedaiu
Copy link
Contributor Author

gedaiu commented Mar 14, 2019

@s-ludwig I managed to trace down this issue. It looks like the vibe.db.mongo.cursor.MongoCursor.destroy() is called during a GC collection. This method calls the m_client.lockConnection() here: https://github.com/vibe-d/vibe.d/blob/master/mongodb/vibe/db/mongo/cursor.d#L296

this is a vibe-core function allocates here: https://github.com/vibe-d/vibe-core/blob/master/source/vibe/core/connectionpool.d#L92

is there a reason why this MongoCursor.destroy operation needs a new connection?

@s-ludwig
Copy link
Member

This got kind of lost here in the vibe-core repository, but what looks like is happening here is that the cursor hasn't been fully processed, so a killCursors command needs to be sent to the MongoDB server to clean it up. I don't think we can do anything simple to fix this, avoiding the GC completely would be the only real option.

But I will add an assertion to provide a better error message/location.

@s-ludwig
Copy link
Member

Actually, reviewing the code, I have already "fixed" this in vibe-d/vibe.d#2794 (fix for pretty much the same issue, vibe-d/vibe.d#2793) - it now simply logs an error. Making this a hard error is IMO the better approach, but I will leave it like this for now.

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

No branches or pull requests

2 participants