Jump to content

Topic on Project:Support desk

Error creating thumbnail: /bin/bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)

10
Jonathan3 (talkcontribs)

Unfortunately I haven't had any help on Extension_talk:PdfHandler since posting Topic:Vhhl16kszn525dl3 a couple of months ago, so I hoped it might reach a wider audience here.

I get the error above when PDF Handler tries to create a thumbnail of PDF files. I guess it is a problem with my server, but any advice would be welcome. Thank you.

Bawolff (talkcontribs)

that's a warning that shouldnt stop pdfs from being created. Its not ideal, but can probably be ignored.

Jonathan3 (talkcontribs)

Thank you. But something is preventing the thumbnails of PDF files from being created, which isn't something I can ignore so easily :-) For example, in the "New Files" page the message appears multiple times (once for each would-be thumbnail location), and in the File: page it appears twice (once where I think the big current page is meant to be, and once where I think the small "next" page is meant to be).

Bawolff (talkcontribs)

i think its likely that some other error is happening in addition to that warning.

Jonathan3 (talkcontribs)

Thank you for your help. I am stuck here as this is all new to me.

Are there a variety of ways to make the thumbnails on MediaWiki? Maybe I could try each in turn.

Or maybe I could try to do it via the command line, to see if it's a problem with the server.

It sounds like ultimately this isn't really a MediaWiki question, but I would be grateful if you could point me in the right direction.

Jonathan3 (talkcontribs)

Does the following, from the MediaWiki log file, help?

File::transform: Doing stat for mwstore://local-backend/local-thumb/my_filename.pdf/page1-170px-my_filename.pdf.jpg
[FileOperation] FileBackendStore::ingestFreshFileStats: File mwstore://local-backend/local-thumb/my_filename.pdf/page1-170px-my_filename.pdf.jpg does not exist
PdfHandler::doTransform: called wfMkdirParents(/path/to/my/directory/media/temp)
PdfHandler::doTransform: ('/usr/bin/gs' '-sDEVICE=jpeg' '-sOutputFile=-' '-sstdout=%stderr' '-dFirstPage=1' '-dLastPage=1' '-dSAFER' '-r150' '-dBATCH' '-dNOPAUSE' '-q' '/path/to/my/directory/media/my_filename.pdf' | '/usr/bin/convert' '-depth' '8' '-quality' '95' '-resize' '170' '-' '/path/to/my/directory/media/temp/transform_30bc4921f2ba.jpg')
[exec] MediaWiki\Shell\Command::execute: /bin/bash '/path/to/my/directory/includes/shell/limit.sh' '('\''/usr/bin/gs'\'' '\''-sDEVICE=jpeg'\'' '\''-sOutputFile=-'\'' '\''-sstdout=%stderr'\'' '\''-dFirstPage=1'\'' '\''-dLastPage=1'\'' '\''-dSAFER'\'' '\''-r150'\'' '\''-dBATCH'\'' '\''-dNOPAUSE'\'' '\''-q'\'' '\''/path/to/my/directory/media/my_filename.pdf'\'' | '\''/usr/bin/convert'\'' '\''-depth'\'' '\''8'\'' '\''-quality'\'' '\''95'\'' '\''-resize'\'' '\''170'\'' '\''-'\'' '\''/path/to/my/directory/media/temp/transform_30bc4921f2ba.jpg'\'')' 'MW_INCLUDE_STDERR=1;MW_CPU_LIMIT=180; MW_CGROUP='\'''\''; MW_MEM_LIMIT=307200; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180; MW_USE_LOG_PIPE=yes'
[exec] Error running /bin/bash '/path/to/my/directory/includes/shell/limit.sh' '('\''/usr/bin/gs'\'' '\''-sDEVICE=jpeg'\'' '\''-sOutputFile=-'\'' '\''-sstdout=%stderr'\'' '\''-dFirstPage=1'\'' '\''-dLastPage=1'\'' '\''-dSAFER'\'' '\''-r150'\'' '\''-dBATCH'\'' '\''-dNOPAUSE'\'' '\''-q'\'' '\''/path/to/my/directory/media/my_filename.pdf'\'' | '\''/usr/bin/convert'\'' '\''-depth'\'' '\''8'\'' '\''-quality'\'' '\''95'\'' '\''-resize'\'' '\''170'\'' '\''-'\'' '\''/path/to/my/directory/media/temp/transform_30bc4921f2ba.jpg'\'')' 'MW_INCLUDE_STDERR=1;MW_CPU_LIMIT=180; MW_CGROUP='\'''\''; MW_MEM_LIMIT=307200; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180; MW_USE_LOG_PIPE=yes': sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)

#0 /path/to/my/directory/includes/GlobalFunctions.php(2152): MediaWiki\Shell\Command->execute()
#1 /path/to/my/directory/includes/GlobalFunctions.php(2182): wfShellExec(string, string, array, array, array)
#2 /path/to/my/directory/extensions/PdfHandler/includes/PdfHandler.php(224): wfShellExecWithStderr(string, string)
#3 /path/to/my/directory/includes/filerepo/file/File.php(1165): PdfHandler->doTransform(LocalFile, string, string, array)
#4 /path/to/my/directory/includes/filerepo/file/File.php(1128): File->generateAndSaveThumb(TempFSFile, array, integer)
#5 /path/to/my/directory/includes/page/ImagePage.php(681): File->transform(array)
#6 /path/to/my/directory/includes/page/ImagePage.php(383): ImagePage->makeSizeLink(array, integer, integer)
#7 /path/to/my/directory/includes/page/ImagePage.php(135): ImagePage->openShowImage()
#8 /path/to/my/directory/includes/actions/ViewAction.php(63): ImagePage->view()
#9 /path/to/my/directory/includes/MediaWiki.php(511): ViewAction->show()
#10 /path/to/my/directory/includes/MediaWiki.php(302): MediaWiki->performAction(ImagePage, Title)
#11 /path/to/my/directory/includes/MediaWiki.php(900): MediaWiki->performRequest()
#12 /path/to/my/directory/includes/MediaWiki.php(527): MediaWiki->main()
#13 /path/to/my/directory/index.php(44): MediaWiki->run()
#14 {main}
[thumbnail] Removing bad 17002-byte thumbnail "/path/to/my/directory/media/temp/transform_30bc4921f2ba.jpg". unlink() succeeded
[thumbnail] thumbnail failed on myservername: error -1 "/bin/bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)" from "('/usr/bin/gs' '-sDEVICE=jpeg' '-sOutputFile=-' '-sstdout=%stderr' '-dFirstPage=1' '-dLastPage=1' '-dSAFER' '-r150' '-dBATCH' '-dNOPAUSE' '-q' '/path/to/my/directory/media/my_filename.pdf' | '/usr/bin/convert' '-depth' '8' '-quality' '95' '-resize' '170' '-' '/path/to/my/directory/media/temp/transform_30bc4921f2ba.jpg')"
[DBQuery] Wikimedia\Rdbms\DatabaseMysqlBase::serverIsReadOnly [0.001s] my.database.host.com: SELECT @@GLOBAL.read_only AS Value
[DBQuery] LCStoreDB::get [0s] my.database.host.com: SELECT  lc_value  FROM `wm_l10n_cache`    WHERE lc_lang = 'en' AND lc_key = 'messages:thumbnail_error'  LIMIT 1
Jonathan3 (talkcontribs)

Topic:S9oieeg5b22k1u0e mentions "... fail image creation. The reason is gs prints out warning messages to stdout and this gets processed by convert and fails of course."

Could it be that ANY error message from ghostscript (such as the local error I'm getting) can cause the whole thing to stop working?

Jonathan3 (talkcontribs)

My hosting provider changed "$wgShellLocale to en_US.utf8 as this is the suggested alternative if C.UTF-8 isn't available" which got rid of the error. Now I get "Error creating thumbnail:" with no details. I don't imagine I've provided enough information to elicit any help, but if I get to the bottom of it I'll explain it here :-)

Bawolff (talkcontribs)

the "Removing bad 17002-byte thumbnail" implies that it succeded, but exited with a non zero exit status so the thumbnail was thrown away.


Error -1 can sometimes mean exit status out of range.

I guess try the individual command from cli as the web user, and try doing the parts separately, see what happens.

Jonathan3 (talkcontribs)

In the end I gave up. Thanks for the assistance though.

The good news is that, having moved from a shared server to an unmanaged VPS, it has started working (with whatever LocalSettings.php settings I had ended up with) :-)

Reply to "Error creating thumbnail: /bin/bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)"