Skip to content

DeadSimplePython/Ch17 /collatz_producer_consumer.py Hangs #6

@johnlicwinko

Description

@johnlicwinko

The program starts up, prompts twice for input, then the never completes. Have to do a CTRL-C to stop the program. Tried the code both in Visual Studio and using python in the Command window on Windows 10. Have spent hours putting in debug statements. Appears the consumer processes and the producer process have different in_queue objects, because their memory addresses differ when I print them out using print(f'{in_queue=}') in the producer method and the consumer method. Basically what I have observed with the debug statements is that the producer is loading up what it thinks is in_queue, and when the consumer method checks its version of in_queue, it is always empty. Again, each method has a different address for in_queue.

Consumer reports: in_queue=<multiprocessing.queues.Queue object at 0x0000012EC466BC50>
Producer reports: in_queue=<multiprocessing.queues.Queue object at 0x000002542A32BC50>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions