Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. How do you diagnose PHP-based SQL problems?

How do you diagnose PHP-based SQL problems?

Scheduled Pinned Locked Moved Solved Support
mysql
13 Posts 3 Posters 2.2k Views 3 Watching
  • 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.
  • girishG Offline
    girishG Offline
    girish
    Staff
    wrote on last edited by
    #4

    Could be getting killed because it's running out of memory. Maybe you can bump the increase the memory limit of mysql service?

    LonkleL 1 Reply Last reply
    0
    • nebulonN nebulon

      Is this a custom app package? I wonder why there is a mysql instance running inside the app. On Cloudron it is recommended to use the mysql addon https://docs.cloudron.io/custom-apps/addons/#mysql instead.

      LonkleL Offline
      LonkleL Offline
      Lonkle
      wrote on last edited by
      #5

      @nebulon Nope, not custom, it's your Wordpress (Developer) app. You're pointing me in the right direction tho - it's gotta be a plugin that, for some reason, is running its own instance of mysql.

      I personally don't get how or why it's 'spawning' the mysql process, waiting a second to say it succeeds and then dies in 5 minutes. 5 minutes must be some kind of timeout and there must be a conflict in the first place that killed mysql.

      Also weird that it eventually succeeds too.

      1 Reply Last reply
      0
      • girishG girish

        Could be getting killed because it's running out of memory. Maybe you can bump the increase the memory limit of mysql service?

        LonkleL Offline
        LonkleL Offline
        Lonkle
        wrote on last edited by
        #6

        @girish said in How do you diagnose PHP-based SQL problems?:

        Could be getting killed because it's running out of memory. Maybe you can bump the increase the memory limit of mysql service?

        That's happened to me before but Cloudron always reports it and I adjust memory. Cloudron is reporting no memory limitations. But just in case, I set it really high IF that is the problem occurring.

        nebulonN 1 Reply Last reply
        0
        • LonkleL Lonkle

          @girish said in How do you diagnose PHP-based SQL problems?:

          Could be getting killed because it's running out of memory. Maybe you can bump the increase the memory limit of mysql service?

          That's happened to me before but Cloudron always reports it and I adjust memory. Cloudron is reporting no memory limitations. But just in case, I set it really high IF that is the problem occurring.

          nebulonN Offline
          nebulonN Offline
          nebulon
          Staff
          wrote on last edited by
          #7

          @lonkle just to be on the same page, since this sounds far out with some plugin spawning a mysql process. The logs you have pasted earlier here, are those from the app or from the mysql service running in your Cloudron?

          LonkleL 1 Reply Last reply
          0
          • nebulonN nebulon

            @lonkle just to be on the same page, since this sounds far out with some plugin spawning a mysql process. The logs you have pasted earlier here, are those from the app or from the mysql service running in your Cloudron?

            LonkleL Offline
            LonkleL Offline
            Lonkle
            wrote on last edited by Lonkle
            #8

            @nebulon said in How do you diagnose PHP-based SQL problems?:

            @lonkle just to be on the same page, since this sounds far out with some plugin spawning a mysql process. The logs you have pasted earlier here, are those from the app or from the mysql service running in your Cloudron?

            That is from the my SQL logs. I found out that's why the entire server would stop functioning for 5 minutes at a time - MySQL unexpectedly dies, retries, dies, retries, dies. I know it's gotta be a plugin. When you said it was spawning an SQL process somehow, I just ran with the idea since you're the expert but I realized that you just thought I was showing you app logs.

            I'v watched the app logs even during one of the random MySQL deaths, and there's nothing on the logs except normal PHP stuff. I cleaned up all the notices and it still happens. I have ONE lead:

            PHP Notice: Undefined offset: 1 in phar:///app/pkg/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 70

            I don't use the WP-CLI, which means it can only be that the 1 minute cron job set up that sometimes runs into some huge task. Something is throwing an undefined offset in the Cron anyway. I'm hoping that's it. If I can find it. 😅

            I'll have to time the next time it happens and see if it aligns with a cron job.

            1 Reply Last reply
            0
            • LonkleL Offline
              LonkleL Offline
              Lonkle
              wrote on last edited by Lonkle
              #9

              Oh, I forgot the Error reconnecting to the database This means that we lost contact with the database server at mysql:3306. This could mean your host’s database server is down. Are you sure the database server is running? Are you sure the database server is not under particularly heavy load? If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums error from Wordpress if you wait till timeout.

              That's why it was so obvious that the SQL server was going down. 🤣

              LonkleL 1 Reply Last reply
              0
              • LonkleL Lonkle

                Oh, I forgot the Error reconnecting to the database This means that we lost contact with the database server at mysql:3306. This could mean your host’s database server is down. Are you sure the database server is running? Are you sure the database server is not under particularly heavy load? If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums error from Wordpress if you wait till timeout.

                That's why it was so obvious that the SQL server was going down. 🤣

                LonkleL Offline
                LonkleL Offline
                Lonkle
                wrote on last edited by
                #10

                Further hunting. There's a plugin called WP Time Capsule that provides a "staging" server to test things out before making them live. It just copies the WP DB and files to a folder at the root called "staging" and if "staging is currently activated" and then I I try to backup Cloudron, I get this Cloudron crashed/stopped.

                But if I delete the staging folder and DB tables (you just hit delete in the plugin). Then Cloudron backs up fine.

                Theories?

                1 Reply Last reply
                0
                • LonkleL Offline
                  LonkleL Offline
                  Lonkle
                  wrote on last edited by Lonkle
                  #11

                  Okay, looks like if I open 20 backend "edit post" pages in new tabs at once I can kill SQL at will. But...how...and why. I understand it running out of memory, but...wait, what if it runs out of memory and doesn't realize it because of swap and so it doesn't kill itself. 🤔

                  1 Reply Last reply
                  0
                  • LonkleL Offline
                    LonkleL Offline
                    Lonkle
                    wrote on last edited by
                    #12

                    Since I can easily reproduce this I did a bunch of tests. Could never pinpoint it but after I updated to V6.3.4, I can't reproduce it at all. So, lucky release for me. 🤣

                    1 Reply Last reply
                    0
                    • girishG Offline
                      girishG Offline
                      girish
                      Staff
                      wrote on last edited by
                      #13

                      Ok, I will mark this as solved but let's investigate further if this comes up again.

                      FWIW, if you do docker exec -ti mysql /bin/bash then the details mysql logs are located at /tmp/mysqld.err .

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Bookmarks
                      • Search