Uploading File failed in Confluence
Asked by Ethan Ethan:

An error log is:

2018-08-23 08:57:40,745 ERROR \[http-nio-8090-exec-69\] \[atlassian.core.util.FileUtils\] copyFile Error writing stream to file: /home/atlassian/data/confluence/attachments/ver003/57/98

/98307/114/65/65614/65622/data2364420793465669874.tmp

-- referer: https://XXXXXXX/pages/viewpage.action?pageId=65614 \| url: /plugins/drag-and-drop/upload.action \| traceId: 6bfc83a514d23d9a \| userName: e2ghost \| action: upload

2018-08-23 08:57:40,746 ERROR \[http-nio-8090-exec-69\] \[persistence.dao.filesystem.FileSystemAttachmentDataUtil\] failedToWriteTempFile Error writing '/home/atlassian/data/confluence/

attachments/ver003/57/98/98307/114/65/65614/65622/data2364420793465669874.tmp' to disk.

......

2018-08-23 08:57:40,750 ERROR \[http-nio-8090-exec-69\] \[confluence.plugins.dragdrop.UploadAction\] execute Failed to save file.

-- referer: https://XXXXXXX/pages/viewpage.action?pageId=65614 \| url: /plugins/drag-and-drop/upload.action \| traceId: 6bfc83a514d23d9a \| userName: e2ghost \| action: upload

java.lang.RuntimeException: java.net.SocketTimeoutException


Answers:
author: Nic Brough -Adaptavist-
body: This is an error from the operating system being passed up to the server.

The server has tried to write data to /home/atlassian/data/confluence.

The operating system has not let it. This could be a range of errors but the most common ones are:

* changed permissions blocking file write
* running out of disk space
* running out of inodes

You will need to check those things on the server.

comments: author: Ethan Ethan
body: ![Xnip2018-08-23_17-18-41.png](https://community.atlassian.com/t5/image/serverpage/image-id/30280i7B4D0727876DCB0D/image-size/large?v=v2&px=999 "Xnip2018-08-23_17-18-41.png")


author: Nic Brough -Adaptavist-
body: Ok, to follow up on what Igor asked about, as it seems to be only one file, can you

* Check that there is nothing in the OS that might block it (virus/malware scanners for example)
* Try uploading a larger file (ideally of the same type) and see if you get the same error
* Manually copy the file on to the server in the same place and see what the error is there (obviously, remove it immediately if it copies ok)

By the way, Confluence should not be run as "root", it should be a dedicated non-root user who has full access and ownership of all the files in the install and data directories.


author: Igor M.
body: Hello,

Can you check if there isn't already file attached to the page with the exact same name that might be open in the editor by someone?

* Does it only happen with one single file or multiple files?
* Does issue occur upon re-upload?
* How big is the file and how long does it take to upload? Or until you get the error?
* Have you checked if on disk permissions in "/home/atlassian/data/confluence/attachments/ver003/57/98/98307/114/65/", if these are the same as the use starting confluence, for example, if Confluence is started with "Confluence" account on disk permissions are not set to root?
* Finally, do you have enough disk space?

Regards,

Igor

comments: author: Ethan Ethan
body: * Does it only happen with one single file or multiple files?  
  **one single JPG file.**
* Does issue occur upon re-upload?  
  **yes, everytime.**
* How big is the file and how long does it take to upload? Or until you get the error?  
  **200KB**
* Have you checked if on disk permissions in "/home/atlassian/data/confluence/attachments/ver003/57/98/98307/114/65/", if these are the same as the use starting confluence, for example, if Confluence is started with "Confluence" account on disk permissions are not set to root?  
  **Confluence started with root.**
* Finally, do you have enough disk space?  
  **yes, it's enough.**   


author: Ethan Ethan
body: BTW, This's a completely new installation.


author: Igor M.
body: Thank you,

Can you try renaming the file to something simple and attempt re-upload?

Regards,

Igor