Coder Social home page Coder Social logo

Comments (4)

weiznich avatar weiznich commented on June 11, 2024

Thanks for opening this bug report. Can you clarify why you believe this is a bug in diesel, especially as the sqlite documentation says "usually", which implies that there are valid cases where this is not the case and given that diesel explicitly calls sqlite3_close for each opened database object:

let close_result = unsafe { ffi::sqlite3_close(self.internal_connection.as_ptr()) };

from diesel.

hillin avatar hillin commented on June 11, 2024

Hi @weiznich , I don't have all the clue that it's a diesel bug, it's just an abnormality that I observed using diesel.

Per the sqlite documentation, the wal files are not deleted if:

  • the last process to have the database open exits without cleanly shutting down the database connection - which should not be the case, as my program is the only process that opens the database, and I guess calling sqlite3_close is sufficient to "cleanly shut down the database connection"?
  • or if the SQLITE_FCNTL_PERSIST_WAL file control is used - this one I'm not sure, could there be a place that implicitly sets this flag?

The documentation did not list a third reason, but since the docs are as comprehensive as they can be, I believe it has covered most of the cases. Also for me it's tolerable if the wal files are not deleted occassionally, but apparently in our use cases they are never deleted, which I think should be addressed as a bug.

from diesel.

weiznich avatar weiznich commented on June 11, 2024

This seems to be related to the fact that you use a read only connection.

https://stackoverflow.com/questions/33177784/sqlite3-wal-shm-files-not-deleted#33184948

from diesel.

hillin avatar hillin commented on June 11, 2024

@weiznich Thanks! That indeed seems to be the problem. A weird behavior in the sqlite implementation but now kind of make sense to me: the -wal file is required to open a db in WAL mode. If sqlite failed to generate the file, it can't even open the db.

(per sqlite docs:)

If the WAL and WAL-index files are missing, then a process that lacks permission to create and initialize those files will not be able to open the database.

from diesel.

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.