OpenLiteSpeed Drupal at DigitalOcean - image styles not working

szy

New Member
#1
Hi there.

That's five days of me trying to successfully run Drupal 10 with the Image Effects module using the DigitalOcean's droplet. I also found some traces of other people's problems with this service.

Is there anyone who has managed to do this? Each of my 15-20 droplets shows:

- 404 errors and image styles generation disappears after some time,

or

- images in the /styles/{name}/public/ directory are generated, but the *original* source image is shown to the viewer instead of the styled image.

I can't figure out the reason for this behavior.

I found a redirection related to this in the Context section of the vhost in the OLS administration - is it correct? Does it help or mess things?

I would be grateful for any help. This service is unusable for me at this time.

Thanks!

Szy.

Drupal core 10.2.0
Image Effects 8.x-3.5
OpenLiteSpeed 1.7.17
 

Cold-Egg

Administrator
#2
Hi,

That Static context (exp:^/sites ...) is for making the Thumbnail or something work by default. I'm not familiar with other modules, if you have the reproduce method and share the origin and styles image whole path, then I can help to take a look.
If you want, can also send it to support@litespeedtech.com
 

szy

New Member
#3
Thanks, but it's impossible for me to reproduce it :(

This happens "automagically" on different stages of the creation of the D10 site. Sometimes after installing Image Effects, sometimes even before it. With D10 10.1 brought originally in a droplet and with the brand new 10.2 version. With the default "sites/defualt/files" directory and with the modified "files" only. With "^" added in .htaccess and with the original file.

It looks like it could happen because of some time process (cache somewhere?), what causes a conflict somewhere in different moments.

It took me 5 last days to find the reason. I gave up. A LAMP droplet went through it without any problem :/

Szy.
 

Cold-Egg

Administrator
#4
Alright then, I can only help if there's a reproduction method.
If this is cache-related, you can try to purge the cache to narrow down the issue.
 

szy

New Member
#5
This was bothering me, so I found the same instance of OpenLiteSpeed Drupal on another provider - Vultr.

And I "one-click-installed" OpenLiteSpeed Drupal here - it looks like exactly the same product/service.

I've got exactly the same error, I'm in the same situation - right after install, when visiting some image style configuration:

DivisionByZeroError: Division by zero in template_preprocess_image_style_preview() (line 72 of /var/www/html/web/core/modules/image/image.admin.inc).

#0 [internal function]: template_preprocess_image_style_preview()
#1 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(261): call_user_func_array()
#2 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(480): Drupal\Core\Theme\ThemeManager->render()
#3 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(240): Drupal\Core\Render\Renderer->doRender()
#4 /var/www/html/web/core/modules/image/src/Form/ImageStyleEditForm.php(64): Drupal\Core\Render\Renderer->render()
#5 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityForm.php(107): Drupal\image\Form\ImageStyleEditForm->form()
#6 [internal function]: Drupal\Core\Entity\EntityForm->buildForm()
#7 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array()
#8 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(283): Drupal\Core\Form\FormBuilder->retrieveForm()
#9 /var/www/html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#10 /var/www/html/web/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult()
#11 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
#12 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#13 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#14 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#15 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#16 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#17 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#18 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#19 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#20 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#21 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#22 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#23 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#24 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#25 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#26 {main}
I'm very sorry because Drupal and OLS/LSWS look like a great combination, but - as you can see - problems with installation are a repeatable situation and probably the same error somewhere "along the way".

Thanks for your willingness to help!

Szy.
 

LiteCache

Active Member
#6
@szy

Check setting for
Code:
memSoftLimit
directive if OLS has this directive. If it is available in OLS encrease the value for this directive. I had similiar problems, but no error log refered to the reason. After encreasing the value for
Code:
memSoftLimit
it worked.
 

Cold-Egg

Administrator
#7
Hi @szy
I looked into it, for "DivisionByZeroError: Division by zero in template_preprocess_image_style_preview() ", it is more like a permission issue. Please try to run the following command:
Code:
chown -R www-data:www-data /var/www/html/web
For the styled image,
If I removed the context for the styled image, then the thumbnail image folder can not be generated. I'm not quite sure how this feature works, is it triggered to generate a thumbnail by the HTTP request to its URL? or what part of the code generates the thumbnail?
I also checked the GD package, it looks alright to me. I will try to locate and fix the issue, but if you have any clue about how it works, please share.
 

Cold-Egg

Administrator
#8
Narrow down the issue to the /var/www/html/web/sites/default/files/.htaccess file. If you remove it, everything works. But the file will auto regenerate by the Drupal.

https://www.drupal.org/project/drupal/issues/360057

If you know which function generates it, maybe we can comment out those lines, or run a cronjob to clean up the .htaccess file from time to time as a workaround method.
 
Top