pepite / Play--Netty

Module that replace the Mina based network stack by the Netty one.
10 stars 5 forks source link

Problems with up.loaded files with Netty #12

Closed dmarko484 closed 14 years ago

dmarko484 commented 14 years ago

I'm using the latest Netty 1.0.2. I found the problem when uploading files to my app. I store uploaded file on server HDD. When I look to uploaded file(directly), I find it is damaged somehow. The filesize is OK but content is changed in some way. For JPG file the file is shows as noise instead of photo. When trying PDF file, I can open the file but acrobat says its corrupted and shows only a part of the content. I can see the similar issues for other file types. When I switch back to Mina, uploads work correctly so it must be something in Netty.

David

pepite commented 14 years ago

Thanks again, I will have a look. I think some chunks are not assembled in the right order...

dmarko484 commented 14 years ago

Hello, do you plan to fix the upload issue soon? BTW: You are doing very nice job working on Netty plugin!!

pepite commented 14 years ago

Thanks, I have been carried aways by some construction works (renovating a room) but I should be able to resume my normal Play! activities during this week. I expect to have this issue fixed by next Monday (maybe sooner if I find some time...)

pepite commented 14 years ago

I have a problem, I don't seem to be able to reproduce your problem. I have added sample app in the module that upload a file. Could you tell me more on how you upload the file?

Thanks

pepite commented 14 years ago

Btw I am re adding the module 1.0.2 to the repo just to be sure it is the same one we are talking about

dmarko484 commented 14 years ago

I have the file declared as 'Upload file' (play.data.Upload) . Then I use FileUtils.moveFileToDirectory(file, dest_folder, true) . I saw you use FileUtils.copyFile. How the uploaded files are beeing managed? Are they deleted from uploaded location? I was not sure so I used moveToDirectory. I also expected that move is much faster than copy for big files(e.g. 400MB). Strange is, that with Mina its working correctly, this is why I thought that its Netty problem. I will test tommorow afternoon with latest Netty 1.0.2 and try to find details.

pepite commented 14 years ago

Yes mina isn't deleting the file but the netty module is. You are probably right that moving the file might be better in that case (if you are on the same disk partition). Moving the file should still be possible anyway. Thanks for you feedback, I will investigate.

pepite commented 14 years ago

I tested with moving big files and small files but still cannot reproduce the issue. Let me know if you can work out the details.

Thanks

pepite commented 14 years ago

Is it still an issue? thanks

dmarko484 commented 14 years ago

Hello, I have a training for a few days so I hope I can test it more at the end of this week. What I did so far is, that I upgraded netty plugin to latest version and tried things as they are but uploaded files were screwed the same way. As told I will decouple my code and try to make some separate example and investigate whats the problem.

pepite commented 14 years ago

Thanks :)

dmarko484 commented 14 years ago

I still have the problem with files uploaded and stored to filesystem. I have controller method similar to this. public static save(File file01){ FileUtils.moveFileToDirectory(file01, dest_folder, true); }

Today I did similar thing but stored files to MongoDB GridFS and its the same problem. When using Mina its fine, but with Netty the files are messed somehow internally. I tested with Netty 1.0.2 and 1.0.3 with the same results.

pepite commented 14 years ago

I am looking at it. Do you have a use case so I can reproduce it more easily?

pepite commented 14 years ago

I cannot reproduce it with the latest play 1.1 (the code should be the same as the module...) Can you test it with play 1.1? Do you have a test case for me? Thanks

pepite commented 14 years ago

Ok should be fixed now.