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

    [SOLVED] Crash reporter - Captive Portal

    Scheduled Pinned Locked Moved 2.3-RC Snapshot Feedback and Issues - ARCHIVED
    16 Posts 4 Posters 3.0k 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.
    • B
      Bilhega
      last edited by

      Maybe the DDL command to check if the table exists is not a good ideia at this point.

      On my "box", I added the code below in captiveportal.inc to check table_exists with a SELECT statement, so no lock is applied… and until now I got 40 connections without any errors.

      $tableCheck = $DB->query("SELECT name FROM sqlite_master WHERE name='captiveportal'");
              if ($tableCheck->fetchArray() === false)
              {
                      if (! $DB->exec($createquery)) {

      ...

      JC Bilhega

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

        Tables, database …. whatever.
        If the file (which contains a 'sqllite3' database) is written out by another 'thread', it will be locked ....

        As an alternative, what out a simple wait for 1 millisecond 'usleep(1000)' ?

        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
        • C
          cmb
          last edited by

          This is the root issue for the "Error message: database is locked. Resetting and trying again" and similar logs, we're looking into it.
          https://redmine.pfsense.org/issues/5622

          1 Reply Last reply Reply Quote 0
          • B
            Bilhega
            last edited by

            I running about 2 days without any erros ( crashes or locking logs ) with the use of busytimeout :

            $DB->busyTimeout(5000);

            if (! $DB->exec($createquery)) {
                    …

            "Sets a busy handler that will sleep until the database is not locked or the timeout is reached."
            public bool SQLite3::busyTimeout ( int $msecs )

            reference: http://php.net/manual/en/sqlite3.busytimeout.php

            I hope this is a good solution.

            JC Bilhega

            1 Reply Last reply Reply Quote 0
            • U
              uaxero
              last edited by

              hi.

              can you show exactly where you enter these parameters in captiveportal.inc

              thanks

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

                @uaxero:

                can you show exactly where you enter these parameters in captiveportal.inc

                Look (Ctrl-F) for :

                 if (! $DB->exec($createquery)) {
                

                ;)

                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
                • U
                  uaxero
                  last edited by

                  ;D ;D

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

                    That one spot's probably adequate for the issue most are hitting, but it needs to be done in more than that spot. This should be the proper fix.
                    https://git.pfmechanics.com/pfsense/pfsense/commit/7c4b3b2060c291a9c166d8196d053afac97861af

                    Next snapshot after the time of this post will have that.

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

                      New snapshots including that fix are out, please try and report back.

                      1 Reply Last reply Reply Quote 0
                      • B
                        Bilhega
                        last edited by

                        @cmb:

                        New snapshots including that fix are out, please try and report back.

                        On my "spot", i got about 120 simultaneous connections and it's working fine. I think it's solved, but could someone with big numbers give us more reports ?

                        Thanks
                          JC Bilhega

                        JC Bilhega

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