disk I/O error with SQLite












4















I have a (tiny) dynamic website that is (roughly) a Perl CGI script using a SQLite database. Package DBI is the abstraction layer used in Perl.



About one week ago, I started to see this error message:



disk I/O error(10) at dbdimp.c line 271


Since this is a hosted site running Apache, I cannot see if the hard disk is (nearly) full. Access to command "df" is disabled.... but I used the (UNIX) shell command "yes > blah" to test the disk can still create new files. My database is very tiny -- less than 50 kilobytes.



I checked file and directory permissions: Directory and all parents are a+r,a+x (all + read/executable). The directory containing my SQLite database file is also a+w (all + write). The database file itself has a+w,a+r (all + read/write).



I wrote a simple Perl program to test I can run the failing select query: It runs fine.



I ran query "VACUUM" on the database. I tried my tests again -- no improvement.



I dumped the SQLite database to raw SQL (using SQLite shell command ".dump") and rebuilt. I tried my tests again -- no improvement.



Any suggestions? I am so confused... Normally, the above list can catch most programming/setup errors.










share|improve this question























  • Can you post the code that executes when the error happens?

    – user610650
    Apr 3 '12 at 13:07











  • Which version of SQLite are you running? And how big is your database? Is this useful - sqlite.org/cvstrac/tktview?tn=3094,3

    – Dave Cross
    Apr 3 '12 at 13:42
















4















I have a (tiny) dynamic website that is (roughly) a Perl CGI script using a SQLite database. Package DBI is the abstraction layer used in Perl.



About one week ago, I started to see this error message:



disk I/O error(10) at dbdimp.c line 271


Since this is a hosted site running Apache, I cannot see if the hard disk is (nearly) full. Access to command "df" is disabled.... but I used the (UNIX) shell command "yes > blah" to test the disk can still create new files. My database is very tiny -- less than 50 kilobytes.



I checked file and directory permissions: Directory and all parents are a+r,a+x (all + read/executable). The directory containing my SQLite database file is also a+w (all + write). The database file itself has a+w,a+r (all + read/write).



I wrote a simple Perl program to test I can run the failing select query: It runs fine.



I ran query "VACUUM" on the database. I tried my tests again -- no improvement.



I dumped the SQLite database to raw SQL (using SQLite shell command ".dump") and rebuilt. I tried my tests again -- no improvement.



Any suggestions? I am so confused... Normally, the above list can catch most programming/setup errors.










share|improve this question























  • Can you post the code that executes when the error happens?

    – user610650
    Apr 3 '12 at 13:07











  • Which version of SQLite are you running? And how big is your database? Is this useful - sqlite.org/cvstrac/tktview?tn=3094,3

    – Dave Cross
    Apr 3 '12 at 13:42














4












4








4








I have a (tiny) dynamic website that is (roughly) a Perl CGI script using a SQLite database. Package DBI is the abstraction layer used in Perl.



About one week ago, I started to see this error message:



disk I/O error(10) at dbdimp.c line 271


Since this is a hosted site running Apache, I cannot see if the hard disk is (nearly) full. Access to command "df" is disabled.... but I used the (UNIX) shell command "yes > blah" to test the disk can still create new files. My database is very tiny -- less than 50 kilobytes.



I checked file and directory permissions: Directory and all parents are a+r,a+x (all + read/executable). The directory containing my SQLite database file is also a+w (all + write). The database file itself has a+w,a+r (all + read/write).



I wrote a simple Perl program to test I can run the failing select query: It runs fine.



I ran query "VACUUM" on the database. I tried my tests again -- no improvement.



I dumped the SQLite database to raw SQL (using SQLite shell command ".dump") and rebuilt. I tried my tests again -- no improvement.



Any suggestions? I am so confused... Normally, the above list can catch most programming/setup errors.










share|improve this question














I have a (tiny) dynamic website that is (roughly) a Perl CGI script using a SQLite database. Package DBI is the abstraction layer used in Perl.



About one week ago, I started to see this error message:



disk I/O error(10) at dbdimp.c line 271


Since this is a hosted site running Apache, I cannot see if the hard disk is (nearly) full. Access to command "df" is disabled.... but I used the (UNIX) shell command "yes > blah" to test the disk can still create new files. My database is very tiny -- less than 50 kilobytes.



I checked file and directory permissions: Directory and all parents are a+r,a+x (all + read/executable). The directory containing my SQLite database file is also a+w (all + write). The database file itself has a+w,a+r (all + read/write).



I wrote a simple Perl program to test I can run the failing select query: It runs fine.



I ran query "VACUUM" on the database. I tried my tests again -- no improvement.



I dumped the SQLite database to raw SQL (using SQLite shell command ".dump") and rebuilt. I tried my tests again -- no improvement.



Any suggestions? I am so confused... Normally, the above list can catch most programming/setup errors.







perl sqlite3 cgi dbi






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 3 '12 at 12:45









kevinarpekevinarpe

10.2k1385110




10.2k1385110













  • Can you post the code that executes when the error happens?

    – user610650
    Apr 3 '12 at 13:07











  • Which version of SQLite are you running? And how big is your database? Is this useful - sqlite.org/cvstrac/tktview?tn=3094,3

    – Dave Cross
    Apr 3 '12 at 13:42



















  • Can you post the code that executes when the error happens?

    – user610650
    Apr 3 '12 at 13:07











  • Which version of SQLite are you running? And how big is your database? Is this useful - sqlite.org/cvstrac/tktview?tn=3094,3

    – Dave Cross
    Apr 3 '12 at 13:42

















Can you post the code that executes when the error happens?

– user610650
Apr 3 '12 at 13:07





Can you post the code that executes when the error happens?

– user610650
Apr 3 '12 at 13:07













Which version of SQLite are you running? And how big is your database? Is this useful - sqlite.org/cvstrac/tktview?tn=3094,3

– Dave Cross
Apr 3 '12 at 13:42





Which version of SQLite are you running? And how big is your database? Is this useful - sqlite.org/cvstrac/tktview?tn=3094,3

– Dave Cross
Apr 3 '12 at 13:42












3 Answers
3






active

oldest

votes


















2














Unfortunately, sqlite3.h isn't very descriptive about what the specific issue is. Error code 10 is defined here:



#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */


You may have an issue with /tmp being full at certain points or sqlite not having access to memory to write its page cache. This is unlikely though if your db is 50kb as sqlite should be able to hold your page cache in memory.



You could try making a copy of the db in the hopes that sqlite can read the copied database and update your code to reflect that:



$sqlite3 your.db
sqlite> begin immediate;
<press CTRL+Z>
$cp your.db copyofyour.db
$exit
sqlite> rollback;


You should also check the logs to see if this is happening with every request or intermittently. You may want to see if you have access to other commands to monitor server health (top, free). Being able to reproduce the issue seems to be your first task at hand. If you can't reproduce it with consistently, it's likely a memory related issue.






share|improve this answer
























  • Nice suggestion! Cool ideas. I will take a note for future issues. Unfortunately, in this case -- it was due to a FreeBSD kernel bug (as explained by support forums for NearlyFreeSpeech.net).

    – kevinarpe
    Apr 4 '12 at 14:23











  • Could you say a bit more about the bug? Think I might be bumping up against something similar...

    – Chris Vandevelde
    Feb 21 '13 at 7:11











  • @ChrisVandevelde: Sorry, NFS.net admins did not provide further details about the FreeBSD <-> SQLite bug. However, my problem has been resolved.

    – kevinarpe
    Jul 22 '13 at 8:06



















1














Another cause for this:




  • Database file is writeable

  • Database journal file (ending in -journal) is not writable


When the database file isn't writable, you get a "readonly database" error. When it's writable, but the journal file is not, you get "I/O error" instead.






share|improve this answer































    0














    A possible, and maybe hard to detect, error source may be if file locking fails. You could test if your file system currently supports file locking with



    flock testfile touch testfile


    NFS file systems for example may exhibit this behavior depending on NFS server configuration.






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9993555%2fdisk-i-o-error-with-sqlite%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      Unfortunately, sqlite3.h isn't very descriptive about what the specific issue is. Error code 10 is defined here:



      #define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */


      You may have an issue with /tmp being full at certain points or sqlite not having access to memory to write its page cache. This is unlikely though if your db is 50kb as sqlite should be able to hold your page cache in memory.



      You could try making a copy of the db in the hopes that sqlite can read the copied database and update your code to reflect that:



      $sqlite3 your.db
      sqlite> begin immediate;
      <press CTRL+Z>
      $cp your.db copyofyour.db
      $exit
      sqlite> rollback;


      You should also check the logs to see if this is happening with every request or intermittently. You may want to see if you have access to other commands to monitor server health (top, free). Being able to reproduce the issue seems to be your first task at hand. If you can't reproduce it with consistently, it's likely a memory related issue.






      share|improve this answer
























      • Nice suggestion! Cool ideas. I will take a note for future issues. Unfortunately, in this case -- it was due to a FreeBSD kernel bug (as explained by support forums for NearlyFreeSpeech.net).

        – kevinarpe
        Apr 4 '12 at 14:23











      • Could you say a bit more about the bug? Think I might be bumping up against something similar...

        – Chris Vandevelde
        Feb 21 '13 at 7:11











      • @ChrisVandevelde: Sorry, NFS.net admins did not provide further details about the FreeBSD <-> SQLite bug. However, my problem has been resolved.

        – kevinarpe
        Jul 22 '13 at 8:06
















      2














      Unfortunately, sqlite3.h isn't very descriptive about what the specific issue is. Error code 10 is defined here:



      #define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */


      You may have an issue with /tmp being full at certain points or sqlite not having access to memory to write its page cache. This is unlikely though if your db is 50kb as sqlite should be able to hold your page cache in memory.



      You could try making a copy of the db in the hopes that sqlite can read the copied database and update your code to reflect that:



      $sqlite3 your.db
      sqlite> begin immediate;
      <press CTRL+Z>
      $cp your.db copyofyour.db
      $exit
      sqlite> rollback;


      You should also check the logs to see if this is happening with every request or intermittently. You may want to see if you have access to other commands to monitor server health (top, free). Being able to reproduce the issue seems to be your first task at hand. If you can't reproduce it with consistently, it's likely a memory related issue.






      share|improve this answer
























      • Nice suggestion! Cool ideas. I will take a note for future issues. Unfortunately, in this case -- it was due to a FreeBSD kernel bug (as explained by support forums for NearlyFreeSpeech.net).

        – kevinarpe
        Apr 4 '12 at 14:23











      • Could you say a bit more about the bug? Think I might be bumping up against something similar...

        – Chris Vandevelde
        Feb 21 '13 at 7:11











      • @ChrisVandevelde: Sorry, NFS.net admins did not provide further details about the FreeBSD <-> SQLite bug. However, my problem has been resolved.

        – kevinarpe
        Jul 22 '13 at 8:06














      2












      2








      2







      Unfortunately, sqlite3.h isn't very descriptive about what the specific issue is. Error code 10 is defined here:



      #define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */


      You may have an issue with /tmp being full at certain points or sqlite not having access to memory to write its page cache. This is unlikely though if your db is 50kb as sqlite should be able to hold your page cache in memory.



      You could try making a copy of the db in the hopes that sqlite can read the copied database and update your code to reflect that:



      $sqlite3 your.db
      sqlite> begin immediate;
      <press CTRL+Z>
      $cp your.db copyofyour.db
      $exit
      sqlite> rollback;


      You should also check the logs to see if this is happening with every request or intermittently. You may want to see if you have access to other commands to monitor server health (top, free). Being able to reproduce the issue seems to be your first task at hand. If you can't reproduce it with consistently, it's likely a memory related issue.






      share|improve this answer













      Unfortunately, sqlite3.h isn't very descriptive about what the specific issue is. Error code 10 is defined here:



      #define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */


      You may have an issue with /tmp being full at certain points or sqlite not having access to memory to write its page cache. This is unlikely though if your db is 50kb as sqlite should be able to hold your page cache in memory.



      You could try making a copy of the db in the hopes that sqlite can read the copied database and update your code to reflect that:



      $sqlite3 your.db
      sqlite> begin immediate;
      <press CTRL+Z>
      $cp your.db copyofyour.db
      $exit
      sqlite> rollback;


      You should also check the logs to see if this is happening with every request or intermittently. You may want to see if you have access to other commands to monitor server health (top, free). Being able to reproduce the issue seems to be your first task at hand. If you can't reproduce it with consistently, it's likely a memory related issue.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Apr 3 '12 at 23:57









      Dave KostonDave Koston

      843




      843













      • Nice suggestion! Cool ideas. I will take a note for future issues. Unfortunately, in this case -- it was due to a FreeBSD kernel bug (as explained by support forums for NearlyFreeSpeech.net).

        – kevinarpe
        Apr 4 '12 at 14:23











      • Could you say a bit more about the bug? Think I might be bumping up against something similar...

        – Chris Vandevelde
        Feb 21 '13 at 7:11











      • @ChrisVandevelde: Sorry, NFS.net admins did not provide further details about the FreeBSD <-> SQLite bug. However, my problem has been resolved.

        – kevinarpe
        Jul 22 '13 at 8:06



















      • Nice suggestion! Cool ideas. I will take a note for future issues. Unfortunately, in this case -- it was due to a FreeBSD kernel bug (as explained by support forums for NearlyFreeSpeech.net).

        – kevinarpe
        Apr 4 '12 at 14:23











      • Could you say a bit more about the bug? Think I might be bumping up against something similar...

        – Chris Vandevelde
        Feb 21 '13 at 7:11











      • @ChrisVandevelde: Sorry, NFS.net admins did not provide further details about the FreeBSD <-> SQLite bug. However, my problem has been resolved.

        – kevinarpe
        Jul 22 '13 at 8:06

















      Nice suggestion! Cool ideas. I will take a note for future issues. Unfortunately, in this case -- it was due to a FreeBSD kernel bug (as explained by support forums for NearlyFreeSpeech.net).

      – kevinarpe
      Apr 4 '12 at 14:23





      Nice suggestion! Cool ideas. I will take a note for future issues. Unfortunately, in this case -- it was due to a FreeBSD kernel bug (as explained by support forums for NearlyFreeSpeech.net).

      – kevinarpe
      Apr 4 '12 at 14:23













      Could you say a bit more about the bug? Think I might be bumping up against something similar...

      – Chris Vandevelde
      Feb 21 '13 at 7:11





      Could you say a bit more about the bug? Think I might be bumping up against something similar...

      – Chris Vandevelde
      Feb 21 '13 at 7:11













      @ChrisVandevelde: Sorry, NFS.net admins did not provide further details about the FreeBSD <-> SQLite bug. However, my problem has been resolved.

      – kevinarpe
      Jul 22 '13 at 8:06





      @ChrisVandevelde: Sorry, NFS.net admins did not provide further details about the FreeBSD <-> SQLite bug. However, my problem has been resolved.

      – kevinarpe
      Jul 22 '13 at 8:06













      1














      Another cause for this:




      • Database file is writeable

      • Database journal file (ending in -journal) is not writable


      When the database file isn't writable, you get a "readonly database" error. When it's writable, but the journal file is not, you get "I/O error" instead.






      share|improve this answer




























        1














        Another cause for this:




        • Database file is writeable

        • Database journal file (ending in -journal) is not writable


        When the database file isn't writable, you get a "readonly database" error. When it's writable, but the journal file is not, you get "I/O error" instead.






        share|improve this answer


























          1












          1








          1







          Another cause for this:




          • Database file is writeable

          • Database journal file (ending in -journal) is not writable


          When the database file isn't writable, you get a "readonly database" error. When it's writable, but the journal file is not, you get "I/O error" instead.






          share|improve this answer













          Another cause for this:




          • Database file is writeable

          • Database journal file (ending in -journal) is not writable


          When the database file isn't writable, you get a "readonly database" error. When it's writable, but the journal file is not, you get "I/O error" instead.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 12 '18 at 23:12









          Alan RobertsonAlan Robertson

          413




          413























              0














              A possible, and maybe hard to detect, error source may be if file locking fails. You could test if your file system currently supports file locking with



              flock testfile touch testfile


              NFS file systems for example may exhibit this behavior depending on NFS server configuration.






              share|improve this answer




























                0














                A possible, and maybe hard to detect, error source may be if file locking fails. You could test if your file system currently supports file locking with



                flock testfile touch testfile


                NFS file systems for example may exhibit this behavior depending on NFS server configuration.






                share|improve this answer


























                  0












                  0








                  0







                  A possible, and maybe hard to detect, error source may be if file locking fails. You could test if your file system currently supports file locking with



                  flock testfile touch testfile


                  NFS file systems for example may exhibit this behavior depending on NFS server configuration.






                  share|improve this answer













                  A possible, and maybe hard to detect, error source may be if file locking fails. You could test if your file system currently supports file locking with



                  flock testfile touch testfile


                  NFS file systems for example may exhibit this behavior depending on NFS server configuration.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 20 '14 at 10:40









                  quazgarquazgar

                  1,7401931




                  1,7401931






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9993555%2fdisk-i-o-error-with-sqlite%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Florida Star v. B. J. F.

                      Danny Elfman

                      Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues