thebatclaudio / wp-rest-api-v2-menus

Adding menus endpoints on WP REST API v2
47 stars 22 forks source link

Bug: Modifications in menu can break the menu endpoint #21

Closed beltranrengifo closed 4 years ago

beltranrengifo commented 4 years ago

Hi there!!

The case:

I deleted a page which had child items in the menu, so this menu changed because the child items become first level items automatically.

At this point I was not able to retrieve this menu anymore. And the server reached 100% CPU usage peaks. I did not get errors, just timeouts. The plugin does not resolve this case.

I'll try to replicate the problem in the next days and look around which function is not working properly.

Let you know.

thebatclaudio commented 4 years ago

Hi @beltranrengifo, I'm very sorry for this. I will try to replicate the problem too, because it's very dangerous! Let me know if you find something useful, thank you!

beltranrengifo commented 4 years ago

Hi! Don't worry @thebatclaudio I'll let you know

thebatclaudio commented 4 years ago

Probably the problem is inside wp_api_v2_menus_dna_test function, that is recursive... I think that I have to rewrite this function to make it not recursive...

thelucre commented 4 years ago

I'm also having this issue. Significant menu changes have caused 502 timeout responses to a specific location request. Any updates @thebatclaudio on the fix at wp_api_v2_menus_dna_test?

thebatclaudio commented 4 years ago

Hi @thelucre, I'm sorry but during these days I'm too busy so I don't think that i will fix this bug soon. I'll probably be working on it in a month.

alextanhongpin commented 4 years ago

We hit the same error recently when trying to change a parent category. Apparently, all child items are untagged, and not tagged to the new parent category. At this point, we seem to hit 100% CPU (most likely due to the infinite recursion).

The simple fix was disabling the plugin, and manually tagging the child category back to the new parent category. After doing that, we enabled the plugin, and things works just fine.