From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Reference counter in smart pointers are not updated properly when used by multiple tasks Date: Thu, 01 Feb 2018 08:41:05 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="fde209702767e7bd2d072a31cc9991c3"; logging-data="7194"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX184hNxz9nokCSg3YzlHH4HpQ75yal9eNaY=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:1MoOFIdiEo6Zg83rwyjaPXVeb5w= sha1:JmRuftOrRXsFtcuxvTGBs3yTVE4= Xref: reader02.eternal-september.org comp.lang.ada:50242 Date: 2018-02-01T08:41:05+00:00 List-Id: onox writes: > So the smart pointers are not working properly when there are jobs > (paired with the same smart pointer) being executed by multiple > workers. I'm not sure if this is a bug in my own code or whether GNAT > is doing something funky in the Finalize procedure. I had a look on macOS. Some messing around required with build system/os choice. GCC 8.0.0 failed with ICE, tried 7.1.0. Doesn't support CPU affinity: commented out. Number of workers 1: OK. Number of workers 2: Worker #2 finished -- refs: 2 Worker #2 dequeueing... Releasing slot... Releasing slot... Worker #1 : ORKA.JOBS.JOB : raised PROGRAM_ERROR : adjust/finalize raised SYSTEM.ASSERTIONS.ASSERT_FAILURE: failed precondition from orka-futures-slots.ads:60 instantiated at orka_test-package_9_jobs.ads:20 Load address: 0x108284000 Call stack traceback locations: 0x108295c11 0x1082a1cd0 0x7fff7da586bf 0x7fff7da5856b Worker #2 : ORKA.JOBS.JOB : raised PROGRAM_ERROR : adjust/finalize raised SYSTEM.ASSERTIONS.ASSERT_FAILURE: failed precondition from orka-futures-slots.ads:60 instantiated at orka_test-package_9_jobs.ads:20 Load address: 0x108284000 Call stack traceback locations: 0x108293228 0x1082946a5 0x1082a1cd0 0x7fff7da586bf 0x7fff7da5856b Jobs not done: RUNNING Releasing slot... Execution terminated by unhandled exception raised PROGRAM_ERROR : adjust/finalize raised PROGRAM_ERROR: orka-smart_pointers.adb:64 explicit raise Load address: 0x108284000 Call stack traceback locations: 0x1082a0f56 0x1082a3dec 0x1082a4cea 0x1082a4aeb 0x1082c1fea 0x7fff7da88fcf 0x7fff7da88ee0 0x108286ac7 0x1082c206a The tracebacks were no good, need to build with MODE=debug; when I do this, I see your problem with the references, Worker #2 dequeueing... Jobs done: DONE 3 Time: 0.009000000 references B (expects >= 1): 2 shutting down... Worker #1 dequeued 0 Worker #1 terminated Worker #2 dequeued 0 Worker #2 terminated shutting down? references C (expects 1): 2 Queue high (expects 0): 0 Queue normal (expects 0): 0 Slots acquired (expects 1): 1