docker-magento icon indicating copy to clipboard operation
docker-magento copied to clipboard

Change xdebug trigger method to improve performance

Open danstaver opened this issue 1 year ago • 7 comments

Description Today, you have to manually enable/disable xdebug, which is taking time, and sometime the user can forget to enable it and wonders why the breakpoint didnt trigger, or, you have the option to always have it enabled, which is negatively affecting performance in local.

It would be great if we could have the same logic in place as what today adobe commerce cloud has, where, even in production i can trigger xdebug, without it affecting regular users https://experienceleague.adobe.com/en/docs/commerce-cloud-service/user-guide/develop/test/debug#debug-for-pro-staging-and-production image What we could try to do, implement something similar to comment #2 from https://github.com/magento/magento-cloud-docker/issues/112#issuecomment-565345812

Steps To Reproduce

  1. N/A

Expected Result

  • xdebug triggers only when XDEBUG_SESSION cookie present in request. This request is being sent to a separate process with loaded and configured xdebug extension
  • if XDEBUG_SESSION cookie not present, request is sent to a process which does not have xdebug loaded at all

Actual Result xdebug is either enabled or disabled (but, even if enabled or disabled, the extension is still loaded)

danstaver avatar Oct 03 '24 16:10 danstaver

I will share my knowledge to simplify the debugging to minimalist setup. Give me some time to prepare PR.

jarzebowsky avatar Feb 02 '25 19:02 jarzebowsky

Hey @danstaver and @Jarzebowsky,

The bin/xdebug script was completely rebuilt in early February (sorry that I forgot to update this ticket). It now starts faster and has a status when running bin/xdebug.

That said, having two containers running here would be cool. @Jarzebowsky if you can offer a minimal setup to get this working, that would be cool! I don't think it would take much to set this up based on the comment at https://github.com/magento/magento-cloud-docker/issues/112#issuecomment-565345812 — I think the only way to do this would be some sort of zero-config setup so the user would never need to run bin/xdebug again (neat).

markshust avatar Mar 13 '25 20:03 markshust

That's exactly what I have prepared for two companies, adjusted to their needs. It's kinda exceeding timeframe I dropped but as soon I will have spare time - will prepare PR - that for sure would be a game changer feature.

jarzebowsky avatar May 15 '25 23:05 jarzebowsky

I have prepared the changes and managed to have it working with small further work to do on my side.

@markshust I would need some instructions regarding how I'm supposed to prepare PR with new docker image(s). Currently I just changed directive to force build from Dockerfile defined locally.

I would also have some future change suggestions to the repository.

If we would be able to resolve those during the weekend the PR will be dropped also at this timeframe 😁

jarzebowsky avatar Jul 05 '25 15:07 jarzebowsky

Hi, @danstaver. I'm Dosu (https://dosu.dev), and I'm helping the docker-magento team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You proposed improving xdebug performance by enabling it only when triggered via an XDEBUG_SESSION cookie to reduce overhead and user errors.
  • @Jarzebowsky has been working on a minimal setup and plans to submit a PR for this enhancement.
  • @markshust supports the idea and mentioned recent improvements to the bin/xdebug script.
  • Progress has been made, and guidance was requested on submitting a PR with new Docker images.
  • The enhancement aims to streamline debugging with a zero-config approach but remains unresolved.

Next Steps:

  • Please let me know if this issue is still relevant to the latest version of docker-magento by commenting here to keep the discussion open.
  • If I don’t hear back within 30 days, this issue will be automatically closed.

Thanks for your understanding and contribution!

dosubot[bot] avatar Oct 04 '25 16:10 dosubot[bot]

Yes it's waiting for @markshust some time already

jarzebowsky avatar Oct 27 '25 17:10 jarzebowsky

@markshust, the user @Jarzebowsky has indicated this issue is still waiting for your input regarding the xdebug performance improvements and the related PR. Could you please assist with this when you have a chance?

dosubot[bot] avatar Oct 27 '25 17:10 dosubot[bot]