Giter VIP home page Giter VIP logo

Comments (5)

sgillies avatar sgillies commented on June 11, 2024

@dazza-codes sqlite is only used in the main process in a single thread. The child processes only do processing of imagery.

Can you be more specific about the deadlock? I've never encountered one. Is it the one described here https://bugs.python.org/issue35267 or a different one?

from rio-mbtiles.

dazza-codes avatar dazza-codes commented on June 11, 2024

Dunno for sure. While processing 1000s of GeoTIFFs on AWS-batch, using RGBA inputs that are fairly big (esp. uncompressed) and zoom levels of about 4..14, the conversions get hung up sometimes. So far, I've forked and sacrificed multiprocessing speed for reliability. While I have a bit of time, revisiting this speed tradeoff to learn more about the project and mess it up 😁 Maybe my mental model of the process is not entirely clear; I probably need to learn to generate a sequence diagram for this or something. I don't know whether the process pool/worker is still active when sqlite is accessed to write out the result of each call to process_tile. There is no explicit termination of the process pool and no context manager at work. I considered just setting the worker-tasks to None so that all the workers live as long as the pool because maybe something is wacky in sharing the global src when the process cleans up after 100 tasks, I dunno. I started to wonder what happens with a map_async callback pattern that might try to save results as they return, but that would mess with sqlite thread safety if that's in the callback handler. I'm also considering whether each process_tile can just throw out a tmp-file (give reproject a tmp-file instead of a MemoryFile) and always return None, then gather up all the tmp-file tile outputs into sqlite after they're all done. Also curious about using dask.delayed in case it has better memory management for large inputs and 1000s of tiles. I see some new work with futures, will take a look at that 👓

from rio-mbtiles.

dazza-codes avatar dazza-codes commented on June 11, 2024

Explored various options and trade-offs in

from rio-mbtiles.

dazza-codes avatar dazza-codes commented on June 11, 2024

There is an interesting comment in https://docs.python.org/3/library/concurrent.futures.html

Changed in version 3.3: When one of the worker processes terminates abruptly,
a BrokenProcessPool error is now raised. Previously, behaviour was undefined
but operations on the executor or its futures would often freeze or deadlock.

This behavior might also apply to Pool when the worker init fails (don't know for sure).

from rio-mbtiles.

sgillies avatar sgillies commented on June 11, 2024

I'm closing for now. The sqlite3 module is only used from a single thread. Python's multiprocessing is more likely to be the cause of deadlocks.

from rio-mbtiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.