upload binary file is broken

Bug #578900 reported by bran
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
play framework
Fix Committed
Critical
Nicolas Leroux

Bug Description

version: 1.1 rev 892, Chinese Windows7, jdk6-16,

Using the file upload example from here:

http://www.playframework.org/documentation/1.0.2/5things

binary files are already a little shorter than the originals, while text file seemed OK.

Changed in play:
milestone: none → 1.1
assignee: nobody → Nicolas Leroux (nicolas-lunatech)
status: New → Confirmed
importance: Undecided → High
importance: High → Critical
Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

It should now be fixed with the new version of Netty. Could you please test and confirm or reopen this issue?

Thanks,

Nicolas

Changed in play:
status: Confirmed → Fix Committed
Revision history for this message
bran (bing-ran) wrote :

rev 893. Now the post request does not even reach the controller. It's dismissed somewhere in the middle before the controller. Can you verify that?

Bing

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

Be sure to ant clean first...

Changed in play:
status: Fix Committed → Confirmed
Revision history for this message
bran (bing-ran) wrote :

Sorry, I did that. That fixed the controller invocation thing. But the file is still few KB shorter than the original. I have also verified that the new version of Netty is used in the classpath. Depressed...

Revision history for this message
bran (bing-ran) wrote :

BTW, will the mina or grizzly module still work? I'd like to test that.

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote : Re: [Bug 578900] Re: upload binary file is broken

I will investigate. The netty part is not the most easy one. Thanks for you bug report as the main problem I have currently is with the testing, so the more you are testing the best I can fix the bugs ;)

Nico

On 12 mei 2010, at 08:29, bran wrote:

> Sorry, I did that. That fixed the controller invocation thing. But the
> file is still few KB shorter than the original. I have also verified
> that the new version of Netty is used in the classpath. Depressed...
>
> --
> upload binary file is broken
> https://bugs.launchpad.net/bugs/578900
> You received this bug notification because you are a bug assignee.
>
> Status in play framework: Confirmed
>
> Bug description:
> version: 1.1 rev 892, Chinese Windows7, jdk6-16,
>
> Using the file upload example from here:
>
> http://www.playframework.org/documentation/1.0.2/5things
>
> binary files are already a little shorter than the originals, while text file seemed OK.
>

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

The grizly module should still work. I will try to fix your bug asap.

Nicolas
On 12 mei 2010, at 08:41, bran wrote:

> BTW, will the mina or grizzly module still work? I'd like to test that.
>
> --
> upload binary file is broken
> https://bugs.launchpad.net/bugs/578900
> You received this bug notification because you are a bug assignee.
>
> Status in play framework: Confirmed
>
> Bug description:
> version: 1.1 rev 892, Chinese Windows7, jdk6-16,
>
> Using the file upload example from here:
>
> http://www.playframework.org/documentation/1.0.2/5things
>
> binary files are already a little shorter than the originals, while text file seemed OK.
>

Revision history for this message
bran (bing-ran) wrote :

Sure. But the grizzly module is still using the old commands.py and won't run.

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

ah, I will have a look at it tonight. Can you report a bug on the bug tracker of the module itself?

Thanks,

Nicolas
On 12 mei 2010, at 09:27, bran wrote:

> Sure. But the grizzly module is still using the old commands.py and
> won't run.
>
> --
> upload binary file is broken
> https://bugs.launchpad.net/bugs/578900
> You received this bug notification because you are a bug assignee.
>
> Status in play framework: Confirmed
>
> Bug description:
> version: 1.1 rev 892, Chinese Windows7, jdk6-16,
>
> Using the file upload example from here:
>
> http://www.playframework.org/documentation/1.0.2/5things
>
> binary files are already a little shorter than the originals, while text file seemed OK.
>

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

Can you verify that you still have this bug? I think it is fixed. Thanks

Changed in play:
status: Confirmed → In Progress
Revision history for this message
bran (bing-ran) wrote :

Not yet working with the current nightly build.

My test file is a bunch of files with random characters in, generated by:

$ dd if=/dev/urandom of=afile.txt bs=1 count={file size}

I have found some magic numbers for the file size that are the threshold from being correct to being wrong.

1. with FF browser, any files that are no bigger than 7912 bytes can be properly uploaded.
2. with Chome, any files that are no bigger than 7920 bytes can be properly uploaded.

Anything longer than that the the uploaded files are almost 2X as large on the server.

The number varies slightly by a few bytes on another machine.

Again, the html for the test:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
 <form action="@{Application.upload()}" method="POST" enctype="multipart/form-data">
     <input type="text" name="title" />
     <input type="file" id="photo" name="f" />
     <input type="submit" value="Send it..." />
 </form>

</body>
</html>

The controller code snippet:

  public static void upload(File f, String title){
     System.out.println("title: " + title);
     System.out.println(f.length());
     UploadUtil.getInstance().saveFile(f.getName(), f);
     renderText("ok");
  }

Again, both machines are windows, JDK6, Chinese locale.

Revision history for this message
bran (bing-ran) wrote :

Ok, just verified the same behavior on Ubuntu 10. The threshold is slightly higher than on Windows but the behavior is consistent.

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

Thanks a lot for the information. I will try to fix that asap.

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

I have just try to reproduce the problem again, but fail to do so. I will install ubuntu 10 on Virtual box to check again. Thanks for your patience.

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

I have just tried o reproduce the problem again, but fail to do so. I will install ubuntu 10 on Virtual box to check again. Thanks for your patience.

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

I am really puzzled as I don't seem to be able to reproduced the bug. I am using exactly the same code except for the UploadUtil of course (but I am assuming that this is not relevant and that you are comparing the original size and the printed size)...

Can you verify that the netty lib is the 3.2.1 final in the lib directory and that there is only that version?

The only difference is the chinese locale but I can't see how that can be relevant... I will do more test on Ubuntu.

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

Good news I can reproduce it on Linux ubuntu (don't understand why I don't have this problem on my Mac though). I am now working on it.

Revision history for this message
Nicolas Leroux (nicolas-lunatech) wrote :

Ok fixed. Please reopen the issue if you are still encountering problems.

Changed in play:
status: In Progress → Fix Committed
Revision history for this message
bran (bing-ran) wrote :

Working now.

What a relief! Thanks for the work.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.