Skip to content

Conversation

@jonathangreen
Copy link
Contributor

@jonathangreen jonathangreen commented Apr 4, 2017

GitHub Issue

Resolves:
Islandora/documentation#577

What does this Pull Request do?

Add a new service for transforming images using imagemagick.

How should this be tested?

  • Get a JWT. I added a dsm here and then performed a write operation on a FedoraResource to print it to the page.
  • Use an HTTP client like Postman, making sure to add your token as an Authorization header for both of the following requests.
  • Add a image to Fedora as a NonRdfSource at http://localhost:8080/fcrepo/rest/some/crazy/path
  • Run the builtin webserver with php -S localhost:8088 -t /path/to/Houdini/src
    • Request the identify JSON for the image sending a GET request to Houdini at http://localhost:8088/identify/some/crazy/path
    • Request a converted image by sending a GET request to Houdini at http://localhost:8088/convert/some/crazy/path

Interested parties

@dannylamb

@ruebot
Copy link
Member

ruebot commented Apr 4, 2017

waits for the wonderful @manez avatar

- `$ cd /path/to/Houdini` and run `$ composer install`
- Then either
- For production, configure your web server appropriately (e.g. add a VirtualHost for Houdini in Apache) OR
- For development, run the PHP built-in webserver `$ php -S localhost:8888 -t src` from Hypercube root.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy pasta

protected $log;

/**
* HypercubeController constructor.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy-Pasta

@manez
Copy link
Member

manez commented Apr 4, 2017

Y'all don't like to make this easy, do you?

image

@codecov
Copy link

codecov bot commented Apr 5, 2017

Codecov Report

Merging #20 into master will increase coverage by 14.73%.
The diff coverage is 98.46%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master      #20       +/-   ##
=============================================
+ Coverage     63.33%   78.06%   +14.73%     
- Complexity       30       42       +12     
=============================================
  Files             3        4        +1     
  Lines            90      155       +65     
=============================================
+ Hits             57      121       +64     
- Misses           33       34        +1
Impacted Files Coverage Δ Complexity Δ
Houdini/src/Controller/HoudiniController.php 98.46% <98.46%> (ø) 12 <12> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2a16e66...7f95550. Read the comment docs.

@whikloj
Copy link
Member

whikloj commented Apr 5, 2017

This might be me and my setup but identify worked great but convert never completes. Hits the max execution time.

Also, Postman on a Mac seems to have trouble with either odd ports or PHP servers. Cause I couldn't connect at all to the PHP server. But curl worked for identify.

Okay, figured out Postman. Need to specify 127.0.0.1 instead of localhost.

I upped my time out to 2 minutes, but it still times out.

Here is the contents of the houdini.log for my failed request...am I doing something wrong?

[2017-04-05 05:28:32] Houdini.INFO: Matched route "{route}". {"route":"GET_convert_fedora_resource","route_parameters":{"_controller":"houdini.controller:convert","fedora_resource":"some/crazy/path","_route":"GET_convert_fedora_resource"},"request_uri":"http://127.0.0.1:8083/convert/some/crazy/path","method":"GET"} []
[2017-04-05 05:28:32] Houdini.DEBUG: > GET /convert/some/crazy/path [] []
[2017-04-05 05:28:32] Houdini.INFO: Convert request. [] []
[2017-04-05 05:28:32] Houdini.DEBUG: X-Islandora-Args: {"args":null} []
[2017-04-05 05:28:32] Houdini.DEBUG: Content Types: [] []
[2017-04-05 05:28:32] Houdini.INFO: Falling back to default content type [] []
[2017-04-05 05:28:32] Houdini.DEBUG: Content Type Chosen: {"type":"image/jpeg"} []
[2017-04-05 05:28:32] Houdini.INFO: Imagemagick Command: {"cmd":"convert - jpeg:-"} []
[2017-04-05 05:31:37] Houdini.ALERT: Fatal Error (E_ERROR): Maximum execution time of 120 seconds exceeded {"code":1,"message":"Maximum execution time of 120 seconds exceeded","file":"/sw/var/www/DAM2/Crayfish/Houdini/vendor/islandora/crayfish-commons/src/CmdExecuteService.php","line":72} []

@jonathangreen
Copy link
Contributor Author

Looks like everything is working okay to me! Is it running on a really big file. I'm thinking the 2 minute timeout may not be enough. If you try running:
convert infile.tiff jpeg:- > output
On the file you were working on, how long does it take?

Maybe just set your PHP timeout to 0, so it runs forever. I'm pretty sure we are going to have to set the timeout for these micro services to a fairly large value if not unlimited.

@ruebot
Copy link
Member

ruebot commented Apr 5, 2017

@whikloj yeah, I ran into the same problem testing the first Hypercube PR, and unfortunately @dannylamb and my conversation in the PR is gone. But! https://github.com/Islandora-CLAW/Crayfish/tree/master/Hypercube#configuration should help out.

@whikloj
Copy link
Member

whikloj commented Apr 5, 2017

So actually it was a JPEG, with

Content-Length →1188660
Content-Type →image/jpeg

Would it being a JPEG to start with make a difference?

@whikloj
Copy link
Member

whikloj commented Apr 5, 2017

🤣

[2017-04-05 14:48:12] Houdini.INFO: Matched route "{route}". {"route":"GET_convert_fedora_resource","route_parameters":{"_controller":"houdini.controller:convert","fedora_resource":"some/crazy/path","_route":"GET_convert_fedora_resource"},"request_uri":"http://127.0.0.1:8088/convert/some/crazy/path","method":"GET"} []
[2017-04-05 14:48:12] Houdini.DEBUG: > GET /convert/some/crazy/path [] []
[2017-04-05 14:48:12] Houdini.INFO: Convert request. [] []
[2017-04-05 14:48:12] Houdini.DEBUG: X-Islandora-Args: {"args":null} []
[2017-04-05 14:48:12] Houdini.DEBUG: Content Types: [] []
[2017-04-05 14:48:12] Houdini.INFO: Falling back to default content type [] []
[2017-04-05 14:48:12] Houdini.DEBUG: Content Type Chosen: {"type":"image/jpeg"} []
[2017-04-05 14:48:12] Houdini.INFO: Imagemagick Command: {"cmd":"convert - jpeg:-"} []
[2017-04-05 14:49:46] Houdini.ALERT: Fatal Error (E_ERROR): Maximum execution time of 0 seconds exceeded {"code":1,"message":"Maximum execution time of 0 seconds exceeded","file":"/sw/var/www/DAM2/Crayfish/Houdini/vendor/islandora/crayfish-commons/src/CmdExecuteService.php","line":72} []

For my Fedora, infinity was not long enough

@ruebot
Copy link
Member

ruebot commented Apr 5, 2017

@whikloj I had problems with 0 too. I ended up making it some large number like 600000 and then it was fine. Could very well be an ubuntu/php bug.

@whikloj
Copy link
Member

whikloj commented Apr 5, 2017

Ohhh wait, I was running this outside of my vagrant setup. Would this need to be inside vagrant? If it can do the identify command then it should work for convert...right?

@whikloj
Copy link
Member

whikloj commented Apr 5, 2017

I'm going to try this with Apache and see if PHP -S is causing my problems.

@dannylamb
Copy link
Contributor

Just tried Houdini locally (not in Vagrant, but pointed to my Fedora in Vagrant) and converted a 28 MB tiff to a JP2 no prawb. Let me know how the apache setup goes (if you can at least report back what it took, we could try and convert that into some install code for claw_vagrant).

@jonathangreen
Copy link
Contributor Author

@whikloj some information on what it took to get hypercube setup with apache here:
https://github.com/Islandora-CLAW/Crayfish/tree/master/Hypercube#apache2

Also for the infinite timeout this might help.

@whikloj
Copy link
Member

whikloj commented Apr 5, 2017

Ok with apache outside of vagrant on my Mac and @jonathangreen's Authorization change tips (thank you for that). I still can't get it done.

It takes 15 seconds to curl download the Tiff from Fedora to outside my vagrant

time curl -i -G -H"Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE0OTE0MDM1MTUsImV4cCI6MTQ5MTQxMDcxNSwidWlkIjoiMSIsIm5hbWUiOiJhZG1pbiIsInJvbGVzIjpbImF1dGhlbnRpY2F0ZWQiLCJhZG1pbmlzdHJhdG9yIl0sInVybCI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6ODAwMCJ9.dI_du4Kk1-MOxanNeH_THOC69onqWV_vmGEK5i2QzPyb4cE0MC1QAfwhTulBMbvKOq-3DXb_-z10V2VkqIGY7dPC9lTbF6-BrXJUsNDb1_fIOzCvS_gq2J88GWMO6wTulek3CyCUleIbPF7nfJjL-7r8_8j0LGOsMNbq1cy7tzH4j0KHz82Ti_Cb7MM8zxmibbOx6sXdisAKgwc1krL7qjTMmy66e5N6Vwl_ynUZeov_7Tdp2EJwxa92gznfvPQ31SIwAXPp9WT8trUsgKEidbwIJvszhVPrkYHCBSaE99_SFqQsfB6hXmJrhLhf0m2uRjt0_IneGv6yfToEtB0gag" "http://localhost:8080/fcrepo/rest/new/crazy/tiff" -H"Accept: /" -o outTiff
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 11.9M 100 11.9M 0 0 791k 0 0:00:15 0:00:15 --:--:-- 471k
curl -i -G -H"Accept: /" -o outTiff 0.03s user 0.11s system 0% cpu 15.475 total

and really no time to convert it

time convert outTiff jpeg:- > outJpeg
convert outTiff jpeg:- > outJpeg 0.14s user 0.04s system 79% cpu 0.235 total

I even tried pointing directly to my convert using the cfg.php. It never completes and what's more it never starts. Here is my current request being processed.

time curl -H"Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE0OTE0MDM1MTUsImV4cCI6MTQ5MTQxMDcxNSwidWlkIjoiMSIsIm5hbWUiOiJhZG1pbiIsInJvbGVzIjpbImF1dGhlbnRpY2F0ZWQiLCJhZG1pbmlzdHJhdG9yIl0sInVybCI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6ODAwMCJ9.dI_du4Kk1-MOxanNeH_THOC69onqWV_vmGEK5i2QzPyb4cE0MC1QAfwhTulBMbvKOq-3DXb_-z10V2VkqIGY7dPC9lTbF6-BrXJUsNDb1_fIOzCvS_gq2J88GWMO6wTulek3CyCUleIbPF7nfJjL-7r8_8j0LGOsMNbq1cy7tzH4j0KHz82Ti_Cb7MM8zxmibbOx6sXdisAKgwc1krL7qjTMmy66e5N6Vwl_ynUZeov_7Tdp2EJwxa92gznfvPQ31SIwAXPp9WT8trUsgKEidbwIJvszhVPrkYHCBSaE99_SFqQsfB6hXmJrhLhf0m2uRjt0_IneGv6yfToEtB0gag" -H"Accept: image/jpeg" "http://houdini.localhost/convert/new/crazy/tiff" > houdiniJpeg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:06:58 --:--:-- 0

Current Speed = 0, and checking top I see

52235 convert 0.0 00:00.16 1 0 14 57M 0B 0B 5030 52187 sleeping *0[1] 0.00000 0.00000 70 18423 168

So it's not calling convert correctly or something.

But I trust you all and once it is incorporated in to vagrant then I'm sure it will work.

@jonathangreen
Copy link
Contributor Author

@whikloj anything interesting in the Houdini log for that last one?

@whikloj
Copy link
Member

whikloj commented Apr 5, 2017

@jonathangreen not really 😞

[2017-04-05 16:03:44] Houdini.INFO: Matched route "{route}". {"route":"GET_convert_fedora_resource","route_parameters":{"_controller":"houdini.controller:convert","fedora_resource":"new/crazy/tiff","_route":"GET_convert_fedora_resource"},"request_uri":"http://houdini.localhost/convert/new/crazy/tiff","method":"GET"} []
[2017-04-05 16:03:44] Houdini.DEBUG: > GET /convert/new/crazy/tiff [] []
[2017-04-05 16:03:44] Houdini.INFO: Convert request. [] []
[2017-04-05 16:03:44] Houdini.DEBUG: X-Islandora-Args: {"args":null} []
[2017-04-05 16:03:44] Houdini.DEBUG: Content Types: [] []
[2017-04-05 16:03:44] Houdini.DEBUG: Content Type Chosen: {"type":"image/jpeg"} []
[2017-04-05 16:03:44] Houdini.INFO: Imagemagick Command: {"cmd":"/usr/local/bin/convert - jpeg:-"} [

@dannylamb
Copy link
Contributor

dannylamb commented Apr 5, 2017

Interestingly enough, if I try to convert to jpeg instead of JP2, I can replicate @whikloj's issue exactly.

From the console of my PHP built-in instance:

[Wed Apr  5 13:32:53 2017] PHP Fatal error:  Maximum execution time of 0 seconds exceeded in /home/daniel/Code/PHP/Crayfish/Houdini/vendor/islandora/crayfish-commons/src/CmdExecuteService.php on line 72
[Wed Apr  5 13:32:53 2017] PHP Stack trace:
[Wed Apr  5 13:32:53 2017] PHP   1. {main}() /home/daniel/Code/PHP/Crayfish/Houdini/src/index.php:0
[Wed Apr  5 13:32:53 2017] PHP   2. Silex\Application->run() /home/daniel/Code/PHP/Crayfish/Houdini/src/index.php:4
[Wed Apr  5 13:32:53 2017] PHP   3. Silex\Application->handle() /home/daniel/Code/PHP/Crayfish/Houdini/vendor/silex/silex/src/Silex/Application.php:477
[Wed Apr  5 13:32:53 2017] PHP   4. Symfony\Component\HttpKernel\HttpKernel->handle() /home/daniel/Code/PHP/Crayfish/Houdini/vendor/silex/silex/src/Silex/Application.php:496
[Wed Apr  5 13:32:53 2017] PHP   5. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /home/daniel/Code/PHP/Crayfish/Houdini/vendor/symfony/http-kernel/HttpKernel.php:68
[Wed Apr  5 13:32:53 2017] PHP   6. call_user_func_array:{/home/daniel/Code/PHP/Crayfish/Houdini/vendor/symfony/http-kernel/HttpKernel.php:153}() /home/daniel/Code/PHP/Crayfish/Houdini/vendor/symfony/http-kernel/HttpKernel.php:153
[Wed Apr  5 13:32:53 2017] PHP   7. Islandora\Houdini\Controller\HoudiniController->convert() /home/daniel/Code/PHP/Crayfish/Houdini/vendor/symfony/http-kernel/HttpKernel.php:153
[Wed Apr  5 13:32:53 2017] PHP   8. Islandora\Crayfish\Commons\CmdExecuteService->execute() /home/daniel/Code/PHP/Crayfish/Houdini/src/Controller/HoudiniController.php:120
[Wed Apr  5 13:32:53 2017] PHP   9. proc_get_status() /home/daniel/Code/PHP/Crayfish/Houdini/vendor/islandora/crayfish-commons/src/CmdExecuteService.php:72
[Wed Apr  5 13:32:53 2017] 127.0.0.1:54156 [500]: /convert/test-page - Maximum execution time of 0 seconds exceeded in /home/daniel/Code/PHP/Crayfish/Houdini/vendor/islandora/crayfish-commons/src/CmdExecuteService.php on line 72

From my log:

[2017-04-05 13:31:52] Houdini.INFO: Matched route "{route}". {"route":"GET_convert_fedora_resource","route_parameters":{"_controller":"houdini.controller:convert","fedora_resource":"test-page","_route":"GET_convert_fedora_resource"},"request_uri":"http://localhost:8088/convert/test-page","method":"GET"} []
[2017-04-05 13:31:52] Houdini.DEBUG: > GET /convert/test-page [] []
[2017-04-05 13:31:53] Houdini.INFO: Convert request. [] []
[2017-04-05 13:31:53] Houdini.DEBUG: X-Islandora-Args: {"args":null} []
[2017-04-05 13:31:53] Houdini.DEBUG: Content Types: [] []
[2017-04-05 13:31:53] Houdini.DEBUG: Content Type Chosen: {"type":"image/jpeg"} []
[2017-04-05 13:31:53] Houdini.INFO: Imagemagick Command: {"cmd":"convert -  jpeg:-"} []
[2017-04-05 13:32:53] Houdini.ALERT: Fatal Error (E_ERROR): Maximum execution time of 0 seconds exceeded {"code":1,"message":"Maximum execution time of 0 seconds exceeded","file":"/home/daniel/Code/PHP/Crayfish/Houdini/vendor/islandora/crayfish-commons/src/CmdExecuteService.php","line":72} []
[2017-04-05 13:33:09] Houdini.INFO: Matched route "{route}". {"route":"GET_convert_fedora_resource","route_parameters":{"_controller":"houdini.controller:convert","fedora_resource":"test-page","_route":"GET_convert_fedora_resource"},"request_uri":"http://localhost:8088/convert/test-page","method":"GET"} []

@jonathangreen
Copy link
Contributor Author

jonathangreen commented Apr 5, 2017

It kind of looks like the process for convert is never exiting...

From the timeout before it timeout before it timed out here:
https://github.com/Islandora-CLAW/Crayfish-Commons/blob/master/src/CmdExecuteService.php#L72

and from the log its calling convert like this:
/usr/local/bin/convert - jpeg:-

Just to see if its something with pipes and your version of convert can you try something like this:
cat outTiff | /usr/local/bin/convert - jpeg:- > test.jpg

When I was testing I was able to convert to a jpeg okay, so I'm not exactly sure what is going on, I'll try to get mine time time out as well though so I can debug. I wonder if its something with running Houdini on a different server from Fedora. All my testing was done in the Vagrant VM.

@dannylamb
Copy link
Contributor

Worked fine. I got some mumbo jumbo from convert, but I viewed the resulting jpeg without issue.

daniel@daniel-Latitude-3560:~/Code/PHP/Crayfish/Houdini$ cat ~/Downloads/Newspaper\ page.tiff | convert - -resize 50% jpeg:- > test.jpg
convert: Unknown field with tag 41728 (0xa300) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/881.
convert: Unknown field with tag 42016 (0xa420) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/881.
daniel@daniel-Latitude-3560:~/Code/PHP/Crayfish/Houdini$ 

@jonathangreen
Copy link
Contributor Author

Just in case its an imagemagick version issue can ya'll post the version of imagemagick that you have installed on the box you are testing Houdini on?

Heres the version I was testing with:

$ convert -version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-02-01 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff webp wmf x xml zlib

@dannylamb
Copy link
Contributor

dannylamb commented Apr 5, 2017

daniel@daniel-Latitude-3560:~/Code/PHP/Crayfish/Houdini$ convert -version
Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-03-14 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib

Looks like I have a slightly newer version. Wouldn't be too concerned. @whikloj?

@whikloj
Copy link
Member

whikloj commented Apr 5, 2017

So here is the info, I'm guessing it is a shell thing.

[[email protected] 13:47 ] 
[/sw/var/www/DAM2/Crayfish/Houdini] 
> identify outTiff 
outTiff TIFF 2042x2044 2042x2044+0+0 8-bit sRGB 12.52MB 0.000u 0:00.000

[[email protected] 13:45 ] 
[/sw/var/www/DAM2/Crayfish/Houdini] 
> cat outTiff | /usr/local/bin/convert -  jpeg:- > newJpeg

[[email protected] 13:46 ] 
[/sw/var/www/DAM2/Crayfish/Houdini] 
> identify newJpeg 
newJpeg JPEG 2042x2044 2042x2044+0+0 8-bit sRGB 495KB 0.000u 0:00.000

[[email protected] 13:46 ] 
[/sw/var/www/DAM2/Crayfish/Houdini] 
> /usr/local/bin/convert -version
Version: ImageMagick 6.9.3-6 Q16 x86_64 2016-02-28 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules 
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib

@whikloj
Copy link
Member

whikloj commented Apr 5, 2017

Side question...and not for right now but have we considered http://php.net/manual/en/book.imagick.php?

I have never used it and I don't know that it won't be super slow or error prone. Just wondering.

@dannylamb
Copy link
Contributor

Hrm... Not to complicate things further, but I set things up on the Vagrant environment to make sure it's apples to apples and I'm still getting that strange issue.

Admittedly, the test tiff I'm using comes from University of Manitoba... so... Maybe @jonathangreen can share the tiff he's using and we can make sure there's nothing funky going on there.

I also played with how the streams get closed in Crayfish Commons, and didn't close STDIN until after the process finished. That actually induced the same error when trying to run identify, so I don't think that's the problem, but maybe there is something with how we're playing with streams.

@jonathangreen
Copy link
Contributor Author

jonathangreen commented Apr 6, 2017

My tiff was not very sophisticated. I needed something with text to test hyper cube against to I took a screenshot of a GitHub ticket and converted it to TIFF to see what Hypercube would so with it. Then since it was already in Fedora thats what I was using to shrink and rotate etc with Houdini. Maybe the key is that is was fairly small. I attached it here for what its worth.

I just did a destroy and I'm brining up the vagrant again, see something about my environment was weird and I see the same issue now.

Added it here: infile.zip

@jonathangreen
Copy link
Contributor Author

so looks like claw vagrant is having some issues maybe?

==> default: Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "serializer.normalizer.entity_reference_item.jsonld" has a dependency on a non-existent service "rest.link_manager". in /var/www/html/drupal/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php on line 58 #0 /var/www/html/drupal/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(42): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processReferences(Array)
==> default: #1 /var/www/html/drupal/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(36): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processDefinition(Object(Symfony\Component\DependencyInjection\Definition))
==> default: #2 /var/www/html/drupal/vendor/symfony/dependency-injection/Compiler/Compiler.php(104): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->process(Object(Drupal\Core\DependencyInjection\ContainerBuilder))
==> default: #3 /var/www/html/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php(598): Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object(Drupal\Core\DependencyInjection\ContainerBuilder))
==> default: #4 /var/www/html/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(1284): Symfony\Component\DependencyInjection\ContainerBuilder->compile()
==> default: #5 /var/www/html/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(873): Drupal\Core\DrupalKernel->compileContainer()
==> default: #6 /var/www/html/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(465): Drupal\Core\DrupalKernel->initializeContainer()
==> default: #7 /var/www/html/drupal/vendor/drush/drush/lib/Drush/Boot/DrupalBoot8.php(149): Drupal\Core\DrupalKernel->boot()
==> default: #8 /var/www/html/drupal/vendor/drush/drush/includes/bootstrap.inc(354): Drush\Boot\DrupalBoot8->bootstrap_drupal_full()
==> default: #9 /var/www/html/drupal/vendor/drush/drush/includes/bootstrap.inc(473): drush_bootstrap(5, 6)
==> default: #10 /var/www/html/drupal/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(59): drush_bootstrap_to_phase(6)
==> default: #11 /var/www/html/drupal/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
==> default: #12 /var/www/html/drupal/vendor/drush/drush/drush.php(12): drush_main()
==> default: #13 {main}
==> default: Drush command terminated abnormally due to an unrecoverable error.       [error]
==> default: Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "serializer.normalizer.entity_reference_item.jsonld" has a dependency on a non-existent service "rest.link_manager". in Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processReferences() (line 58 of /var/www/html/drupal/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php).

I give up for tonight.

I have some other business to attend to tomorrow, but I'll see if I can get an environment together where this fails and find a solution to it in the next couple days. If anyone has any ideas whats up though, they are more then welcome 😄

@ruebot
Copy link
Member

ruebot commented Apr 6, 2017

Verified explosion: https://gist.github.com/ruebot/0be99a86e332ae15ab7f679ee2e9adbf

Did this while doing a clean test build for islandora-deprecated/claw_vagrant#33

I'll dig into it more tomorrow morning.

@whikloj
Copy link
Member

whikloj commented Apr 6, 2017

So I did some more digging and I am positive that the streamed data is not getting to convert, so I hang in this loop.

But I solved it and I'm not sure I understand how. I'm not very fluent in streams but...I stopped waiting. I commented out the above loop which leaves $exit_code = null; so that skips the STDERR if statement and instead returns the function.

And I got the image back.

[[email protected] 23:11 ] 
[/sw/var/www/DAM2/Crayfish/Houdini] 
> curl -o newPng -H"Accept: image/png" -G -H"Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE0OTE0NDU3MzQsImV4cCI6MTQ5MTQ1MjkzNCwidWlkIjoiMSIsIm5hbWUiOiJhZG1pbiIsInJvbGVzIjpbImF1dGhlbnRpY2F0ZWQiLCJhZG1pbmlzdHJhdG9yIl0sInVybCI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6ODAwMCJ9.OwN4pPC8u2x-yQlpqnlhsl1mQ4QdNJIU3uLOwmHaG8O38LfsVYhqG29UA7a3cgqVQGNv0Ipwpj_faL4Cv1t6boGqJ_KzKOWELFM93JR4lFbHatwlOk5RzD-TQeL0XcN0VIMoMjsSuNbca-MeMkzQpaKAZ_7k2DYXWtk-aj7juoXKfPPH3qju14n7Xk3dlMgfae40XAPLJfXkVIyHmOCS4O3WJJP8cZy3ykAUmWRoS1SMPk-k2MNq_N69x4uLle8bq8ob6EhofvavFmROAeD03C8A4n0gG3lKl-haho3VuRLa62S8I58mTqdQSvBGSHbF5oVBNok4kaHs3xKTk4gFxA" "http://127.0.0.1:8088/convert/new/crazy/tiff"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2891k    0 2891k    0     0   855k      0 --:--:--  0:00:03 --:--:--  855k

[[email protected] 23:12 ] 
[/sw/var/www/DAM2/Crayfish/Houdini] 
> identify newPng 
newPng PNG 2042x2044 2042x2044+0+0 8-bit sRGB 2.961MB 0.000u 0:00.000

[[email protected] 23:12 ] 
[/sw/var/www/DAM2/Crayfish/Houdini] 
> curl -H"Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE0OTE0NDU3MzQsImV4cCI6MTQ5MTQ1MjkzNCwidWlkIjoiMSIsIm5hbWUiOiJhZG1pbiIsInJvbGVzIjpbImF1dGhlbnRpY2F0ZWQiLCJhZG1pbmlzdHJhdG9yIl0sInVybCI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6ODAwMCJ9.OwN4pPC8u2x-yQlpqnlhsl1mQ4QdNJIU3uLOwmHaG8O38LfsVYhqG29UA7a3cgqVQGNv0Ipwpj_faL4Cv1t6boGqJ_KzKOWELFM93JR4lFbHatwlOk5RzD-TQeL0XcN0VIMoMjsSuNbca-MeMkzQpaKAZ_7k2DYXWtk-aj7juoXKfPPH3qju14n7Xk3dlMgfae40XAPLJfXkVIyHmOCS4O3WJJP8cZy3ykAUmWRoS1SMPk-k2MNq_N69x4uLle8bq8ob6EhofvavFmROAeD03C8A4n0gG3lKl-haho3VuRLa62S8I58mTqdQSvBGSHbF5oVBNok4kaHs3xKTk4gFxA" -H"Accept: image/jpeg" -o newJpeg "http://127.0.0.1:8088/convert/new/crazy/tiff"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  483k    0  483k    0     0   502k      0 --:--:-- --:--:-- --:--:--  501k

[[email protected] 23:13 ] 
[/sw/var/www/DAM2/Crayfish/Houdini] 
> identify newJpeg 
newJpeg JPEG 2042x2044 2042x2044+0+0 8-bit sRGB 495KB 0.000u 0:00.009

@ruebot
Copy link
Member

ruebot commented Apr 6, 2017

@ruebot
Copy link
Member

ruebot commented Apr 6, 2017

@dannylamb
Copy link
Contributor

Yeah, so I was messing around last night too and it seems that PHP will hang if either output buffer with proc_open gets larger than 4 kB. So we gotta read from STDOUT to a temp stream during that loop. I have a sort of working fix for that. I can issue a PR to Crayfish Commons later today.

@jonathangreen
Copy link
Contributor Author

jonathangreen commented Apr 6, 2017

Maybe we want to look into using a library to manage the streams, something like:
https://github.com/reactphp/child-process

Might make our life easier or might be a blackhole I dunno...

@ruebot
Copy link
Member

ruebot commented Apr 6, 2017

claw_vagrant build resolved with islandora-deprecated/drupal-project@0c7090a

@whikloj
Copy link
Member

whikloj commented Apr 6, 2017

@jonathangreen Thank looks interesting, keeping in mind that I'm not well versed in stream issues. Have you used that before?

@whikloj
Copy link
Member

whikloj commented Apr 6, 2017

Or what about https://symfony.com/doc/current/components/process.html ??

@DiegoPino
Copy link
Contributor

@whikloj that is a fancy wrapper around

http://php.net/manual/en/function.pcntl-fork.php ?

I have used that more brute force child with success. But if symfony does the process handling for you that sounds like a good choice.

reactphp is cool also, but requires a different approach and integration. Mainly, if you go reactphp, all works better if the whole thing is reactphp

@whikloj
Copy link
Member

whikloj commented Apr 6, 2017

While reading the reactphp thing I also noticed this warning.
https://github.com/reactphp/child-process#sigchild-compatibility

It is not the issue I was running against, but we might want to be aware of it in case we get one in the wild.

...you know eventually...in the wild... 🐯

@dannylamb
Copy link
Contributor

dannylamb commented Apr 6, 2017

Y'all should try this out: Islandora/Crayfish-Commons#4

If this blows up again, I think it'd be a good idea to go down the https://github.com/reactphp/stream rabbit hole.

EDIT: Or any of the other libraries mentioned. I should refresh my cache more often.

@whikloj
Copy link
Member

whikloj commented Apr 6, 2017

With @dannylamb's change to Crayfish-Commons (Islandora/Crayfish-Commons#4) I am now 👍 to this service.

@ruebot
Copy link
Member

ruebot commented Apr 6, 2017

@whikloj I'll give you the merge honour

@whikloj whikloj merged commit c033e47 into Islandora:master Apr 6, 2017
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

Successfully merging this pull request may close these issues.

6 participants