Infinite Loop & Memory Exhaustion with Two Plugins and Custom Code
-
✅ What We Are Trying to Do
We have a custom REST API endpoint registered via
functions.phpto:- Accept a token and email.
- Verify them.
- Return a newly generated token for a third-party system.
🧩 Custom Code Used in
functions.php- A REST route is created:
api/authwork/tokenwork/ - Code verifies:
- Token presence and match.
- Email existence.
- If matched, generates a new token and returns it.
⚠️ Problem Faced
- After enabling both the following plugins:
http-requests-managerthe-events-calendar
- AND placing the above code in
functions.php,- Any request to
wp-jsonendpoint leads to an infinite loop. - This causes server memory exhaustion.
- Any request to
🐞 Error Logged in
debug.logPHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 2097152 bytes) in wp-content/plugins/http-requests-manager/http-requests-manager.php on line 2570🧪 Initial Findings
- The infinite loop occurs only when:
- Both plugins are active.
- Custom REST code is placed in the theme’s
functions.php.
- Removing either plugin OR the custom code resolves the issue.
- Likely culprit is how one plugin hooks into HTTP requests or the REST API.
📌 Need Support Team To Help With
- Investigate conflicts or recursive hooks triggered by:
http-requests-manager‘s HTTP interception.- Custom REST endpoint triggering internal REST calls indirectly.
- Provide any temporary workaround, such as:
- Code-level exclusion to not track this specific route inside
http-requests-manager. - Filters or action deregistration advice.
- Code-level exclusion to not track this specific route inside
- Suggest best practice for such custom API implementation when plugins manage HTTP or REST hooks.
- Curl Call:
curl --location 'http://localhost/wordpress-test/wp-json/api/authwork/tokenwork?email=thetechopd%40gmail.com' \
--header 'Authorization: Bearer xcsdvssdvsdvssvd'
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Infinite Loop & Memory Exhaustion with Two Plugins and Custom Code’ is closed to new replies.