Can't upload certain JPG

Discussion in 'PHP' started by DJ XtAzY, Sep 19, 2013.

  1. DJ XtAzY

    DJ XtAzY Member

    I'm having trouble uploading some JPG files via XenForo using the pecl module Imagick. This is what I'm seeing in the log

    2013-09-18 21:30:51.215	INFO	[] connection to [/tmp/lshttpd/lsphp5.sock] on request #1, confirmed, 1, associated process: 23018, running: 1, error: Connection reset by peer!
    2013-09-18 21:30:51.216	NOTICE	[] POST request in process stage, fail with 503
    2013-09-18 21:30:51.216	NOTICE	[] oops! 503 Service Unavailable
    2013-09-18 21:30:51.216	NOTICE	[] Content len: 3815115, Request line: 'POST /attachments/do-upload.json?hash=11f4de011966c97eb60dc7472b7867a5&content_type=post HTTP/1.1'
    2013-09-18 21:30:51.216	INFO	[] Cookie len: 960, bb_lastvisit=1367301784; bb_lastactivity=0; bbstyleid=13; bblastvisit=1371013067; bblastactivity=0; __cfduid=d9185843170c224c0670e3a62da994af71376443716242; roksprocket-showitems=1; c07b50619127c165d59132ce6c92e1e7=355f3eb9e4626042214e7836063fd2cc; 773819b5a6eb00138c0f4f5f3a4691d8=eebad68ed5e29cc42071ca43db78c54f; xf_session=50e54bd7dcbc695584195ee68794d3a4; xf_FilterList_adminphptemplates=0%2Cextra; xf_edit_style_id=15; 07a7ced02363f4f3dfb07608b96cdcb6=e091820006bfc6194848f7f3402a9188; xf_inlinemod_threads=42369%2C43147%2C44097%2C44098%2C44131%2C44447%2C44465%2C44479%2C44491%2C44504%2C44522%2C44554%2C44582%2C44583%2C44596%2C44598%2C44602%2C44604%2C44611%2C44621%2C44638%2C44642; xf_session_admin=c0f5ad77cf64267a460eacfcdc5c1600; __utma=117157078.1319378082.1370316941.1379546287.1379553287.136; __utmb=117157078.10.10.1379553287; __utmc=117157078; __utmz=117157078.1372386650.47.4.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)
    2013-09-18 21:30:51.216	NOTICE	[] Redirect: #1, URL: /index.php
    2013-09-18 21:30:51.216	INFO	[] File not found [/home/someuser/public_html/503.shtml]
    2013-09-18 21:30:51.216	INFO	[] abort request..., code: 4
    Switching to Apache 2.2 i have no issues uploading any JPG files. Only happens when using LiteSpeed. Currently I'm using version 4.2.4 with php 5.4.19 and XCache v3.0.3. I already tried enabling\disabling XCache, suExec feature; max body size is 500MB, php.ini with the typical upload settings for large files, etc. Again this only happens in LiteSpeed, not Apache.

    EDIT: Not sure if I posted in the right section.
    Last edited: Sep 19, 2013
  2. NiteWave

    NiteWave Administrator

    is it random issue or can easily re-produce it?
  3. DJ XtAzY

    DJ XtAzY Member

    Easily reproduced. Not every JPG files experience this. Some uploads through, some don't. On Apache however, everything goes through. I don't have any security filters setup either.
  4. NiteWave

    NiteWave Administrator

    how did you build Imagick with lsapi ? may need check the step.
  5. DJ XtAzY

    DJ XtAzY Member

    Since I'm using cPanel, I simply issued this command to build Imagick:

    pecl install imagick

    Current version is 3.1.0. It automatically wrote my php.ini by enabling the extension.
  6. NiteWave

    NiteWave Administrator

    for WHM/cPanel, we always suggest to use easyapache to build php(for apache), then build matching php in WHM litespeed plugin(for litespeed)

    I'm not quite sure if build by
    pecl install imagick
    directly will be 100% compatible with lsphp
  7. DJ XtAzY

    DJ XtAzY Member

    Yup that's exactly what I did. I used Easyapache to build apache, then had WHM build a matching php for LS. Easyapache doesn't automatically build since there are no options to enable it in the config, so it must be done separately. the pecl install imagick command did build it directly since it grabbed the version and compiled it afterwards.
  8. mistwang

    mistwang LiteSpeed Staff

    maybe your memory limit for lsphp5 external app is too low?
    Anything in stderr.log?
  9. DJ XtAzY

    DJ XtAzY Member

    I got this.

    libgomp: Thread creation failed: Resource temporarily unavailable
    2013-09-18 21:24:06.313 [STDERR]
    libgomp: Thread creation failed: Resource temporarily unavailable
    2013-09-18 21:28:45.760 [STDERR]
    libgomp: Thread creation failed: Resource temporarily unavailable
    2013-09-18 21:30:51.212 [STDERR]
    libgomp: Thread creation failed: Resource temporarily unavailable
    2013-09-20 00:27:45.970 [STDERR]
    libgomp: Thread creation failed: Resource temporarily unavailable
    2013-09-20 00:39:03.440 [STDERR]
    libgomp: Thread creation failed: Resource temporarily unavailable
    I could try recompiling ImageMagick with the --disable-openmp during configure or place putenv("MAGICK_THREAD_LIMIT=1") somewhere, but the thing is is that I won't need to do this if I was using Apache. Articles said ImageMagick convert command was probably taking too much memory.

    My memory limit for the lsphp5 is left at default:
    Memory Soft Limit (bytes) 450M
    Memory Hard Limit (bytes) 500M
    Last edited: Sep 20, 2013
  10. NiteWave

    NiteWave Administrator

    try to increase them, e.g.,
    Memory Soft Limit (bytes) 750M
    Memory Hard Limit (bytes) 800M

Share This Page