dkd / plantuml

PlantUML Plugin for Redmine
MIT License
50 stars 40 forks source link

help:500 Internal Server Error #3

Closed hexistore closed 7 years ago

hexistore commented 9 years ago

how to solve this error?

Started GET "/redmine/plantuml/svg/plantuml_88358e9331985a8ad4ec566b38dfd68a2875ead47b187542e2bea02c670d50ff.svg" for 127.0.0.1 at 2015-09-10 11:43:08 +0800 Processing by PlantumlController#convert as Parameters: {"content_type"=>"svg", "filename"=>"plantuml_88358e9331985a8ad4ec566b38dfd68a2875ead47b187542e2bea02c670d50ff"} Current user: liupeng (id=3) Sent file /data/redmine/files/plantuml_88358e9331985a8ad4ec566b38dfd68a2875ead47b187542e2bea02c670d50ff.svg (0.2ms) Completed 500 Internal Server Error in 5ms

lterekhov commented 6 years ago

I have a similar problem. (png also) plantuml_problem

Started GET "/plantuml/svg/plantuml_014e26497d93d28d0134c188ce0a5d58daa0013747eae594c935857213061d9e.svg" for 213.87.155.38 at 2018-08-27 14:34:24 +0000
Processing by PlantumlController#convert as 
  Parameters: {"content_type"=>"svg", "filename"=>"plantuml_014e26497d93d28d0134c188ce0a5d58daa0013747eae594c935857213061d9e"}
  Current user: l.terekhov (id=5)
Sent file /usr/src/redmine/files/plantuml_014e26497d93d28d0134c188ce0a5d58daa0013747eae594c935857213061d9e.svg (0.2ms)
Completed 500 Internal Server Error in 9ms (ActiveRecord: 2.7ms)

ActionController::MissingFile (Cannot read file /usr/src/redmine/files/plantuml_014e26497d93d28d0134c188ce0a5d58daa0013747eae594c935857213061d9e.svg):
  plugins/plantuml/app/controllers/plantuml_controller.rb:7:in `convert'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'
  plugins/redmine_dmsf/lib/redmine_dmsf/webdav/custom_middleware.rb:62:in `call'

How to solve it?

My redmine is deployed in the docker.

My plantuml section in Dockerfile:

#pluntuml
RUN apt-get update && apt-get install -y default-jre graphviz
COPY ./Dockerfiles/plantuml_lib/plantuml /usr/bin/plantuml
COPY ./Dockerfiles/plantuml_lib/plantuml.jar /opt/plantuml.jar
RUN chmod u+x /usr/bin/plantuml \
&& chown redmine:redmine /usr/bin/plantuml

Contents of file plantuml:

#!/bin/bash
/usr/bin/java -Djava.io.tmpdir=/var/tmp -Djava.awt.headless=true -jar /opt/plantuml.jar ${@}

My redmine info:

Environment:
  Redmine version                3.4.6.stable
  Ruby version                   2.4.4-p296 (2018-03-28) [x86_64-linux]
  Rails version                  4.2.8
  Environment                    production
  Database adapter               PostgreSQL

Plugin settings: plantuml_setting

haiyanghaiyang commented 6 years ago

@lterekhov I got the same issue today and spent a little time debug it. Finally I found it is incorrect file permission of plantuml.jar.

First you can check apache2 error log /var/apache2/log/error.log (or if you using other web container, please check related log). There is message prnted as this,

App 24096 stderr: Error: Unable to access jarfile /var/plantuml/lib/plantuml.jar                                                                                              
App 24096 stderr:   

Then I found the plantuml.jar owner is root, and other user cannot access it. For apache2 service, it is running as www-data user. So I do these to fix the problem,

cd /var/plantuml/lib
chown www-data:www-data plantuml.jar
chmod 755 plantuml.jar
service apache2 restart

I'm not using plantuml docker here but start from scratch. Please check which user the web container is running with and set that accordingly, which may not "www-data".

Other than this, please check,

  1. Whether java is installed correctly. (I'm using jre8 on ubuntu 16.04 docker)
  2. Whether /usr/bin/plantuml has execute permission (chmod 755 /usr/bin/plantuml)

For any issue, other than check Redmine production log, you also need check web container log like error.log of apache2.

There was a similar thread here which is incorrect permission of /usr/bin/plantuml.

https://github.com/sameersbn/docker-redmine/issues/261

PS: Why this problem happens on docker? I think it is because on docker, sudo doesn't work. Every file copied will belong to root. Then we may forget to change correct owner of related files.