Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Error during table cpzone1 creation. Error message: database is locked

    Scheduled Pinned Locked Moved Captive Portal
    27 Posts 3 Posters 4.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      amitaussie
      last edited by

      Hi,

      Gertjan, thanks for your explanation

      File size you asked is 550912, it not even in Mbs

      I noted file size at 7am and there were only 512 user online at that time, might be file size grows when there are more users.

      Server CPU type copied from pfsense

      Intel(R) Xeon(R) CPU X5550 @ 2.67GHz
      Current: 1665 MHz, Max: 2665 MHz
      16 CPUs: 2 package(s) x 4 core(s) x 2 SMT threads

      I am using a 7200 RPM SATA 1Tb HDD

      Regards

      1 Reply Last reply Reply Quote 0
      • A
        amitaussie
        last edited by

        Hi

        Gertjan,

        I have implemented the changes suggested by you, to see results I need to check it for atleast 1 day. I ll update about the result.

        Hope it ll work

        Regards

        1 Reply Last reply Reply Quote 0
        • GertjanG
          Gertjan
          last edited by

          Good.

          Do you have a tool like this : https://www.test-domaine.fr/munin/brit-hotel-fumel.net/pfsense.brit-hotel-fumel.net/portalusers.html ? (my real time captive portal users stats).

          Keep my fingers crossed.

          No "help me" PM's please. Use the forum, the community will thank you.
          Edit : and where are the logs ??

          1 Reply Last reply Reply Quote 0
          • A
            amitaussie
            last edited by

            Hi,

            Nope, I don't have any tool like this, I check users and bandwidth graphs on RRd. What more functionalities does your graph tool give than RRD?

            Usage increased up to 14% and users currently logged in CP are 1520.

            copied from pfsense
            /var/run (ufs in RAM): 14% of 3.4M

            Max users expected to log in CP are up to 3000, so if it increases to 40% then I think there won't be any problem.

            Good thing is I myself have faced this error of database is locked till yesterday, but after changes, it doesn't occur before me, but updates from other users are still pending…

            Regards

            1 Reply Last reply Reply Quote 0
            • GertjanG
              Gertjan
              last edited by

              @amitaussie:

              Nope, I don't have any tool like this, I check users and bandwidth graphs on RRd. What more functionalities does your graph tool give than RRD?

              I wanted to have a tool that monitors my servers (on the Internet). I added also some graphs coming from pfSense, which isn't "on the net" of course.
              It helps me to see from everywhere 'on the planet' how things are going without logging in remotely.
              If I was responsible for the access of several thousand of users, I would really consider adding such tools. It could run on a 'couple of $' VPS.

              My pfsense setup https://www.test-domaine.fr/munin/brit-hotel-fumel.net/pfsense.brit-hotel-fumel.net/index.html (and look one level up, you could see all my servers).

              @amitaussie:

              Good thing is I myself have faced this error of database is locked till yesterday, but after changes, it doesn't occur before me, but updates from other users are still pending…

              So far, so good  :)
              If users have logging problems related to the errors you showed above, then log-lines present in pfsense WILL tell you even before they come to you.

              Keep checking the size of the RAM disk - when this one goes full, pfsense WILL panic. (but I guess it won't happen).

              No "help me" PM's please. Use the forum, the community will thank you.
              Edit : and where are the logs ??

              1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan
                last edited by

                Check out this https://forum.pfsense.org/index.php?topic=103732.0 (it concerns a pfsense Beta 2.3 but the part where the errors come from looks the same / didn't change … )
                Time for a  :( I guess ....
                Probably we are on the wrong track.

                => Still no errors anymore ?

                Btw : your are using a VM or is your pfsense running on a native device ?

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 0
                • A
                  amitaussie
                  last edited by

                  Hi,

                  Gertjan,

                  There are no database errors reported from anywhere in the network till

                  I think that changes have worked, I ll keep checking it for few more days.

                  Thank you,

                  I have read that thread you mentioned, but those errors might be due to vmware.

                  I am not using vmware. Pfsense is running on native hardware.

                  I am facing another CP error though, this error has not started after the changes but it was already happening.

                  Error is CP service stops and then CP  page does not pop up.
                  CP service does stop in 48 hours. I have also seen sometimes squidguard service does stop but it starts automatically but CP service does not start automatically, I manually have to restart.

                  1 Reply Last reply Reply Quote 0
                  • GertjanG
                    Gertjan
                    last edited by

                    @amitaussie:

                    ….
                    Error is CP service stops and then CP  page does not pop up.
                    CP service does stop in 48 hours. I have also seen sometimes squidguard service does stop but it starts automatically but CP service does not start automatically, I manually have to restart.

                    Before (2.2.5 ?) squid and Captive portal was impossible.
                    Now : I don't know (I don't know why I should use Squid …)
                    My Captive Portail never dies.

                    All I know is : Squid + Captive portal …. unstable, or worse.

                    No "help me" PM's please. Use the forum, the community will thank you.
                    Edit : and where are the logs ??

                    1 Reply Last reply Reply Quote 0
                    • A
                      amitaussie
                      last edited by

                      Hi,

                      I am using Pfsense at 2 more places and at every place no pf users are 1200-1400. I have never faced any database locked error or CP service stopped error and there are always 200-400 concurrent users 24/7.

                      And there also I am using squid2.7 + squid-guard and CP authentication and using 2.2.5 version, but started from version 2.0.1 and never faced any such difficulties .

                      Regards

                      1 Reply Last reply Reply Quote 0
                      • C
                        cmb
                        last edited by

                        This is the root issue, we're working on it.
                        https://redmine.pfsense.org/issues/5622

                        1 Reply Last reply Reply Quote 0
                        • A
                          amitaussie
                          last edited by

                          Hi,

                          Hope to see a solution soon.

                          Thanks and regards

                          1 Reply Last reply Reply Quote 0
                          • GertjanG
                            Gertjan
                            last edited by

                            "Soon" might be right now : https://forum.pfsense.org/index.php?topic=103732.new;topicseen#new

                            No "help me" PM's please. Use the forum, the community will thank you.
                            Edit : and where are the logs ??

                            1 Reply Last reply Reply Quote 0
                            • A
                              amitaussie
                              last edited by

                              ok, I got it.

                              So should I undo the earlier changes made in /var/run ?

                              Regards

                              1 Reply Last reply Reply Quote 0
                              • C
                                cmb
                                last edited by

                                @amitaussie:

                                So should I undo the earlier changes made in /var/run ?

                                Absolutely, yes. That was never a good idea. Though you can just wait until a fixed snapshot's available and upgrade to it to make sure you're back to a sane state.

                                I just committed what should be a good fix for the issue here. 2.2.6 snapshot builders just restarted, we'll have a new snapshot in a couple hours that'll hopefully fix this.

                                1 Reply Last reply Reply Quote 0
                                • C
                                  cmb
                                  last edited by

                                  Those who are seeing this issue, please try the newest available 2.2.6 snapshot and report back. It looks to be fixed, but I would like additional confirmation.
                                  64 bit
                                  https://snapshots.pfsense.org/FreeBSD_releng/10.1/amd64/pfSense_RELENG_2_2/updates/?C=M;O=D

                                  32 bit
                                  https://snapshots.pfsense.org/FreeBSD_releng/10.1/i386/pfSense_RELENG_2_2/updates/?C=M;O=D

                                  1 Reply Last reply Reply Quote 0
                                  • A
                                    amitaussie
                                    last edited by

                                    Ok,

                                    I,ll apply the 2.2.6-64bit snapshot and report back.

                                    Thanks and Regards,

                                    1 Reply Last reply Reply Quote 0
                                    • A
                                      amitaussie
                                      last edited by

                                      Sorry for late reply. As I cant afford to down server even for 15 mins for last 4 days for some urgent time bound jobs.

                                      I just upgraded to 2.2.6 release.

                                      AND again I just saw the  following error at CP login page, as this is the best time to check this error as lots of hit for CP authentication are coming, what I do, I keep on refreshing the CP authentication page, I do not enter my login id and password. So after 2-3 refreshes I am able to see this error on my system. So anywhere else in the network, other people would also be seeing this error.

                                      Warning: SQLite3::exec(): database is locked in /etc/inc/captiveportal.inc on line 2045 Warning: SQLite3::query(): Unable to prepare statement: 5, database is locked in /etc/inc/captiveportal.inc on line 2057

                                      I haven't seen this error in last 4-5 days when I implemented changes suggest by Gertjan.

                                      I am reverting back to Gertjan suggested changes for the time being…

                                      Regards

                                      Regards & Thanks

                                      1 Reply Last reply Reply Quote 0
                                      • GertjanG
                                        Gertjan
                                        last edited by

                                        @amitaussie:

                                        Warning: SQLite3::exec(): database is locked in /etc/inc/captiveportal.inc on line 2045

                                        Line 2045 : https://github.com/pfsense/pfsense/blob/RELENG_2_2/etc/inc/captiveportal.inc#L2045 - a simple log line
                                        @amitaussie:

                                        Warning: SQLite3::query(): Unable to prepare statement: 5, database is locked in /etc/inc/captiveportal.inc on line 2057

                                        Line 2057 : https://github.com/pfsense/pfsense/blob/RELENG_2_2/etc/inc/captiveportal.inc#L2057 == empty line ??,

                                        Your file /etc/inc/captiveportal.inc contains the edits that puts the database file on RAM (what I suggested in the beginning), but this doesn't explain why your version of /etc/inc/captiveportal.inc is so much different as the original : https://github.com/pfsense/pfsense/blob/RELENG_2_2/etc/inc/captiveportal.inc
                                        The database error should happen around lines 1300 - 1400 ….
                                        You're NOT using an original pfsense setup, it has been patched with something else ??

                                        No "help me" PM's please. Use the forum, the community will thank you.
                                        Edit : and where are the logs ??

                                        1 Reply Last reply Reply Quote 0
                                        • A
                                          amitaussie
                                          last edited by

                                          Hi,

                                          Gertjan!

                                          My captiveportal.inc is different as I am using a file which is patched for manual logout as mentioned in this post of yours
                                          https://forum.pfsense.org/index.php?topic=77143.15

                                          But after making changes in /var/run database error is certainly not appearing and everything is working ok.

                                          Regards

                                          1 Reply Last reply Reply Quote 0
                                          • A
                                            amitaussie
                                            last edited by

                                            Hi

                                            Gertjan!

                                            I am not able to find changes you suggested for /var/run.

                                            Can you please re-send the changes as these were helping.
                                            Regards

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.