Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profiler stuck on processing #591

Open
TKrisee opened this issue Aug 4, 2022 · 5 comments
Open

Profiler stuck on processing #591

TKrisee opened this issue Aug 4, 2022 · 5 comments

Comments

@TKrisee
Copy link

TKrisee commented Aug 4, 2022

I'm trying to get clockwork to work with the xdebug profiler within sail (laravel docker) to no avail.

The related php.ini config

[XDebug]
zend_extension = xdebug.so
xdebug.mode = develop,debug,gcstats,profile
xdebug.start_with_request = trigger
xdebug.discover_client_host = true
xdebug.idekey = VSC
xdebug.client_host = host.docker.internal
xdebug.client_port = 9003
xdebug.use_compression = false

I've checked the previous issues regarding this topic and I disabled the compressions in the xdebug config, but it did not change anything.

The filename is present in the response header and also exists on the filesystem, but for some reason, clockwork is stuck on "Processing profile..."
Screenshot 2022-08-04 at 15 39 45

Am I missing something here?

@itsgoingd
Copy link
Owner

Hey, can you please send me the output of http://your.app/__clockwork/1659619567-1067-1921841239/extended to info@underground.works for further investigation?

This will contain various details about your app, please make sure you are not sharing something you are not comfortable with.

@TKrisee
Copy link
Author

TKrisee commented Aug 4, 2022

Hey, can you please send me the output of http://your.app/__clockwork/1659619567-1067-1921841239/extended to info@underground.works for further investigation?

This will contain various details about your app, please make sure you are not sharing something you are not comfortable with.

Sure, I've sent you a mail with two files actually, hope it will help

@natenatters
Copy link

Hey @TKrisee , I had a similar issue today. I was using Sail and only had to add these to the .env:

SAIL_XDEBUG_MODE=profile
SAIL_XDEBUG_CONFIG="client_host=host.docker.internal profiler_output_name=cachegrind.out.%R"

I dont know if its because of how Clockwork reads the profiler output, but this is why it works: underground-works/clockwork-app#109 (comment)

@brunofunnie
Copy link

brunofunnie commented Jul 22, 2023

I know this issue is old but there's a lack of info regarding the "Performance -> Profiler" tab in Clockwork to work with Docker so let me give my two .cents of contribution

First of all, no, if you use Docker the Clockwork plugin won't magically access the files within, you'll need to create a volume outside the container and do a little of configuration, at the end is simple, steps bellow:

Xdebug ini config (explanation first)

  • Since the default location for the Xdebug profiles is /tmp and I don't want any extre temp files I've changed it to a new location inside the container, like '/cache' for example.
  • Also the content of the profiler doesn't seem to be adding the MyController.php profiling records, I ended up figuring out that it was overwriting with each request the same file even having the output_name set to 'cachegrind.out.%p', so I need to add 'xdebug.profiler_append' parameter set to 1

So the xdebug.ini file will look like this:

xdebug.mode = profile
xdebug.start_with_request = trigger
xdebug.output_dir = /cache
xdebug.profiler_append = 1

Docker Compose

Your 'volumes' config in you 'docker-compose.yml' file will look something like this:

volumes:
    - '.:/var/www/html'
    - './docker/xdebug.ini:/etc/php/8.1/cli/conf.d/xdebug.ini'
    - './cache:/cache'

Also Xdebug automatically send a Http Header with the location of the profile file called 'X-Xdebug-Profile-Filename', and of course it uses the 'output_dir' config. It will look something like this:

X-Xdebug-Profile-Filename: /cache/cachegrind.out.19

Which will point to your machine's root not the project root which usually doesn't have a /cache directory (change to a different name if it does), then you'll need to create a symlink from your projects cache dir to that dir, it will look something like this:

sudo ln -s /home/<your user>/your/project/directory/cache /cache

That's all, remember to click in the Enable Profile button in the "Profiler" tab and you are good to go.

As a final advice, remember deleting your cachegrind.out file as it gets bigger pretty fast (each refresh on page) and it starts lagging the Clockwork extension when you open the Profiler tab

@itsgoingd
Copy link
Owner

I don't think you want to use xdebug.profiler_append, as this will cause all requests to be merged into a single profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants