Git Product home page Git Product logo

Comments (15)

johngodley avatar johngodley commented on August 18, 2024

Crash the entire server and it has to be restarted? Or just return an error?

You will need to look at your server and see what the error is. For example, is it running out of memory, is it timing out etc.

from search-regex.

samjco avatar samjco commented on August 18, 2024

Plugin crashing the whole server..
Then server seems to reboot on it own.
Plugin is making 91 calls..
I only have the plugin running as the only plugin
I am trying run this :
<p><span(\s\w+?[^=]*?="[^"]*?")*?\s+?class="(\S+?\s)*?connect-button(\s\S+?)*?".*?>(.*?)<\/span></p>
to remove html off each of the posts in post table

from search-regex.

johngodley avatar johngodley commented on August 18, 2024

Your screenshot is too small to really see anything. The arrow appears to be pointing at admin-ajax.php, which the plugin does not use.

It should not be possible for anything to crash your server, and it would imply unrelated issues with your configuration.

It's entirely possible that your regular expression is exceeding the PHP memory limit, and that is something you will know by looking in your server logs.

from search-regex.

samjco avatar samjco commented on August 18, 2024

I boost up the PHP memory limit to 4GB and it still crashes

https://cdn.livechat-files.com/api/file/lc/att/4817491/1ae3c2c5f7677f93d0e884e76f23eb7e/2021-01-12_16-36-54.png
https://cdn.livechat-files.com/api/file/lc/att/4817491/ccdedba2ded079249b9af804cde0f8b7/2021-01-12_16-48-47.png

image

If i do it singularly (1 by 1)it works

from search-regex.

johngodley avatar johngodley commented on August 18, 2024

Ok, as I said, the plugin doesn't use admin-ajax.php so that is not related.

The second screenshot seems to be an issue with your REST API. That isn't connected.

As I mentioned above, you should look at your server error logs and see what is happening.

If the regular expression is running out of memory then you will need to change the expression, or do fewer replacements at once. There's not much the plugin can do about this.

from search-regex.

samjco avatar samjco commented on August 18, 2024

Ok, as I said, the plugin doesn't use admin-ajax.php so that is not related.

The second screenshot seems to be an issue with your REST API. That isn't connected.

As I mentioned above, you should look at your server error logs and see what is happening.

If the regular expression is running out of memory then you will need to change the expression, or do fewer replacements at once. There's not much the plugin can do about this.

Its not the ajax... the plugin is still running 91 calls. I've disabled everything

from search-regex.

johngodley avatar johngodley commented on August 18, 2024

Its not the ajax... the plugin is still running 91 calls. I've disabled everything

The plugin will make as many calls as is required to perform the replace. 91 calls will not crash your server.

from search-regex.

samjco avatar samjco commented on August 18, 2024

@johngodley
So I've had tried everything I can possibly think of....But it keeps cause my server to time out or crash.
I get a JSON syntax error. The crazy part is that I know that my RegEx works because when I click SEARCH, within the plugin it pulls out the correct results..... But when I click Replace ALL... that when it crashes.

image

Then you have this strange thing:
Process show 60% done but no items affected out of 37K posts..
image

from search-regex.

johngodley avatar johngodley commented on August 18, 2024

But it keeps cause my server to time out or crash.

Which one is it? You've said several different things, and shown several different problems, but they're not consistent and I really don't know what the situation is and what is or isn't working.

I will restate the above which is that if a plugin can cause your server to reboot then there is something wrong with your server - nothing should be able to cause it to reboot. The information you've given is a bit contradictory.

The crazy part is that I know that my RegEx works

I'm not saying that your regular expression doesn't work, just that it may be causing excessive memory usage.

Process show 60% done but no items affected out of 37K posts

Sure. Maybe the first 60% of posts don't match.

Why are there big green buttons on your search form? That is not part of the plugin.

from search-regex.

samjco avatar samjco commented on August 18, 2024

OK.. I finally got it working...
Not sure which fix it.. But it is definitely something worth looking into.
I change my regex to capture from starting point to endpoint. Simplifying the regex a bit might have worked... BUT I also remove Cloudflare (turning OFF the cloud icon in the DNS) and using a server SSL let encrypt... I've also changed "REMOVE" to "SINGLE" and in the single field I just add a space (in order to get the Repace All button to enable)

<p><span class="connect-button[\s\S]*?/a></p>

image

My Regexr.com example:
https://regexr.com/5k79h

BTW, you should consider adding the link to regexr.com in your plugin

from search-regex.

samjco avatar samjco commented on August 18, 2024

@johngodley you should consider connecting to replacing inside the DB as an option instead of entirely working through JSON REST.

from search-regex.

samjco avatar samjco commented on August 18, 2024

@johngodley
OK. here is my final verdict... There is a bug somewhere in the plugin when dealing with thousands of posts and certain Expressions.

Which causes a 502 Bad Gateway Error... This is the error that was meant by crashing my server OR timing out the server.

This error happens when something is not matched Over and Over within the search process...

As mentioned... I simplify my expression a bit to: <p><span class="connect-button[\s\S]*?/a></p> which worked!
But then when I tried the same code changing just the class name to optin-button <p><span class="optin-button[\s\S]*?/a></p>
I know that the expression is simple and correct because when I run a search:
image

The problem happened again...
So again my verdict is that when you have 37k or more posts and the processor doesn't find a match readily, this causes the server to produce a 504 error, I think to do time-to-live which I've set to 3000 seconds on my server...

My server has plenty of RAM and Cores I've given 4GB to PHP and Mysql alone. plenty of time for execution... so there should be no issues.

from search-regex.

johngodley avatar johngodley commented on August 18, 2024

regexr.com in your plugin

There is a link to regex101.com in the documentation.

you should consider connecting to replacing inside the DB as an option instead of entirely working through JSON REST

That is not possible.

The plugin uses PHP to perform regular expressions and has no control over how that works. As I've mentioned several times, it is possible to construct a regular expression that causes issues.

from search-regex.

samjco avatar samjco commented on August 18, 2024

This issue is still unresolved.
Why the close?

from search-regex.

johngodley avatar johngodley commented on August 18, 2024

If you have solved the problem by simplifying your regular expression then that is the solution - you are in control of the expression.

from search-regex.

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.