Open ericvanderlinden opened 5 years ago
This looks like a straight-up bug – we assign a temporary directory from the loris.Loris.tmp_dp
config setting, but never do anything to check the directory exists or that we can write to it!
You should be able to fix this by running mkdir -p /tmp/loris2/tmp
on the system that’s running Loris. I’ll have a look at writing a patch so that Loris handles this automatically.
It is always a good ideas to do the checking, but in this case the tmp directory in /tmp/loris2 did exist.
Okay, that’s weird. There might be a problem if Loris didn’t have permissions, say, but then I’d expect to see a different error coming out.
Wel I put the permissions on 777 just to make sure... but I still get the same error.
You closed this with a solution to a problem I did not have. So I think I must conclude from this you have no ideas...
It got closed automatically by GitHub. I take it you’re still seeing this error?
Yes. I was about to rewrite the function in webapp.py to create a temp file bypassing the python module. To see if the problem is python NamedTemporaryFile.
Does Loris keep versions of webapp.py somewhere in a cache? I have tried to change some line of code to see what would happen. And now it seems like I get a different response every time I reload.
To be honest... I think I'm going to give up... Maybe there is some problem with Ubuntu 18.04... and temp files....
I deleted temp_file = NamedTemporaryFile( ... And created a new binairy file with open() to see if a file is created... But no file created.
Now I get the same error as befor... but also: Server Side Error: [Errno 2] No such file or directory: '/tmp/loris2/tmpfile2.jpg'
This is likely a permissions problem, though it's possible that there was a problem with the source file (/usr/local/share/images/01/03/0001.jpg). (500)
Server Side Error: [Errno 2] No such file or directory: '/tmp/loris2/tmp/tmp/file2.jpg'
This is likely a permissions problem, though it's possible that there was a problem with the source file (/usr/local/share/images/01/03/0001.jpg). (500)
@ericvanderlinden could you try using a different tmp directory? Maybe try setting the tmp directory to be in your home directory, and see if anything changes. Is /tmp a normal directory on /, or is it mounted somehow?
I changed the temp directory to /home/loris/tmp
What happened was that as I kept reloading the image Loris seemed to hope from one version of the loris.config and webapp.py to the other, but did not use the latest version. The reason I was puzzled by this behavior is that I have never experienced this before and I have been using a Leaseweb virtual server for the last 4 yours.
This morning I restarted the server and now it works.
Maybe /home/loris is a better initial setting.
For your information: server: https://www.leaseweb.com/nl/cloud/public/virtual-server installed 2/2019 with Ubuntu 18.04 and the most recent versions of all software like Apache etc.
@ericvanderlinden does "mount | grep /tmp" return anything on the machine?
Sorry I have been away. Mount | grep /tmp returns nothing.
@ericvanderlinden can you confirm that you can create a file in /tmp as the loris user? If it works using "touch /tmp/test", maybe you could try with a tiny python script like this:
import tempfile
with tempfile.NamedTemporaryFile(dir='/tmp', delete=False) as f:
print(f.name)
f.write('test')
Does it create the file there?
I logged in as loris. cd /tml I started nano and created a file test.txt This was successful. Then I create a directory mkdir loristest This was successful as well
I hope this answers your question
ok, that shows that the Loris user can create files/directories in /tmp. You could try the little python script if you want. I'm not sure why the Loris code can't create files, when the loris user can.
I have installed Loris according to the documentation. Everything seems to be fine exept I get a Internal Server Error (500) because a temp should be created and it is not created. I'm on Ubuntu 18.
I have searched via google for reports of similar errors but nothing.
Any ideas?