Error Saving

Post about any bugs or other issues that you find on AAO.

Moderator: EN - Forum Moderators

Post Reply
Dodgey
Posts: 8
Joined: Wed Dec 30, 2015 7:50 am
Gender: Male
Spoken languages: English, Learning Japanese

Error Saving

Post by Dodgey »

Failed to save : the server received a malformed set of data. Please retry.
If the problem persists, please report this problem on the forums, giving also the information below :


Debug:47480/69360|ents":[]}}

I did a quick search if there was any forums of this and from what I could find, nothing. What does it mean?
AceAttorneyMaster111
Posts: 468
Joined: Sat Sep 27, 2014 6:46 pm
Gender: Male
Spoken languages: English, français, un poco de español, עברית
Location: USA

Re: Error Saving

Post by AceAttorneyMaster111 »

So… what happened? Can you explain everything you did leading up to and including the error?
User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: Error Saving

Post by Enthalpy »

That particular message occurs after saving through the editor failed, though the message itself has me puzzled. The fact that the "Failed to save" part appears at all tells me that this trial was saved through the editor, but if that was the case, we should see an additional '|ents":[]}}_plus_ten_more_characters' on the debug message. Are you sure that you gave us the complete error message? The plus_ten_more_characters is very important.

I'll look into the probable causes for this after I puzzle that mystery out, but this will probably be a job for Unas.

EDIT: Moved to bug reports.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
User avatar
Unas
Admin / Site programmer
Posts: 8850
Joined: Tue Jul 10, 2007 4:43 pm
Gender: Male
Spoken languages: Français, English, Español
Contact:

Re: Error Saving

Post by Unas »

This error usually happens when there is a connectivity error during the transmission of the trial data. Like if your wifi was unstable, or something like that. Most of the time, it's a pretty random thing : retrying to save may work.

However, it may also happen when a trial contains some special character that is not correctly handled yet, causing the trial data to be truncated in the middle.

The debug message means that your complete trial data was 69360 bytes long, but the server only received 47480 bytes - and ents":[]}} are the 10 last characters that were received.

The first surprising part is, as highlighted by Enth, that you should have some more characters afterwards. The system is supposed to add one more section to the debug log to try to determine what character caused the issue, if it's a badly escaped special character indeed.

The second surprising part is that the 10 last received characters look very much like the correct ending characters for a trial. If the end of your trial data was received, it leaves two possible explanations :
  • What's missing in your trial's data is some part in the middle, instead of being truncated and missing the end.
    This is unlikely, I don't think I've ever seen something similar.
  • All the data was received, but its byte length was incorrectly computed. This is probably the most likely, as it's quite tricky to have a consistent byte length computation between PHP and web browsers.

Here are a few questions that could help us investigate further :
  • Did retrying to save consistently display the same message, with the same numbers in the debug line, or did it change ?
  • Did your changes on your trial contain any unusual special character ? In particular, were you typing in a language that makes use of non-english characters ?
  • Please give me the User Agent string of the web browser you used when you got this issue. To find it, visit this page with the same browser : http://whatsmyuseragent.com/
ImageImageImage
If knowledge can create problems, it is not through ignorance that we can solve them.
Si le savoir peut créer des problèmes, ce n'est pas l'ignorance qui les résoudra. ( Isaac Asimov )
User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: Error Saving

Post by Enthalpy »

That's a length difference of over 30%. Can an issue in the byte length calculation really cause that problem?

The other reason why I'm hesitant to accept that explanation is the raw numbers. A quick call of JSON.stringify(trial_data).length on trial 83526, the trial that the auto-backup data says Dodgey was working on before submitting this report, gives me 57830. How does adding bytes to a trial that was agreed to be 57830 before give you 47480? Also according to the auto backup, it looks like this trial hasn't been saved since he started this topic. That trial, by the way, is in English.

And a quick side note - line 56 of editor_save.js, shouldn't that | be escaped? That shouldn't cause the missing character, but it's worth pointing out.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
User avatar
Unas
Admin / Site programmer
Posts: 8850
Joined: Tue Jul 10, 2007 4:43 pm
Gender: Male
Spoken languages: Français, English, Español
Contact:

Re: Error Saving

Post by Unas »

Enthalpy wrote:That's a length difference of over 30%. Can an issue in the byte length calculation really cause that problem?
It might in a trial making use of many non-latin characters. It all depends on the encoding which was used to compute the length.
For example, a chinese character like 中 counts for 3 bytes in UTF-8, while only 1 byte in GBK (the default encoding in Chinese browsers).
In this case, the character will count as 1 in the length returned by Javascript, but may count as 3 when computing the length in PHP if don't select the correct encoding.
In principle, on AAO everything should be forced to UTF-8 to maintain consistency, but well, one never knows. It's relies so much on the browser's settings and behaviour...
That being said, if you say the trial is fully in English, then it's very unlikely.

Then, maybe the middle part was really cut off for some reason, but that's very weird. As far as I know, in TCP, packets are ordered : if some packets in the middle are lost during transfer, the server should know automatically that the ordering no longer matches...

Then, the two questions ("Was this reproduced consistently with the same numbers, or random ?" and "Which browser are you using ?") are the main things to know.
Enthalpy wrote:And a quick side note - line 56 of editor_save.js, shouldn't that | be escaped? That shouldn't cause the missing character, but it's worth pointing out.
Indeed, nice catch.
ImageImageImage
If knowledge can create problems, it is not through ignorance that we can solve them.
Si le savoir peut créer des problèmes, ce n'est pas l'ignorance qui les résoudra. ( Isaac Asimov )
Dodgey
Posts: 8
Joined: Wed Dec 30, 2015 7:50 am
Gender: Male
Spoken languages: English, Learning Japanese

Re: Error Saving

Post by Dodgey »

I did consistently try to save and the same message came up, and the browser I'm using is Firefox.
User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: Error Saving

Post by Enthalpy »

Can you give us more detailed information about the browser? As Unas said, use the link here.

Also, did you add any "strange" characters when editing the trial? If it appears on a standard keyboard, it's fine.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
Dodgey
Posts: 8
Joined: Wed Dec 30, 2015 7:50 am
Gender: Male
Spoken languages: English, Learning Japanese

Re: Error Saving

Post by Dodgey »

I didn't add any unusual characters when I was editing my trial.

User agent string: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0
User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: Error Saving

Post by Enthalpy »

Thanks for answering all these questions. This next one is a very small point, but it could prove useful.

Is that an exact copy-paste of the error message you got? Did you copy-paste the entire thing, or did you copy the error message, hit enter manually, and then copy-paste the debug information? If you can still reproduce the original message, please double-check.

I know it seems silly, but this could be an important clue.
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
Dodgey
Posts: 8
Joined: Wed Dec 30, 2015 7:50 am
Gender: Male
Spoken languages: English, Learning Japanese

Re: Error Saving

Post by Dodgey »

I am almost certain I copied the entire message.
User avatar
Enthalpy
Community Manager
Posts: 5169
Joined: Wed Jan 04, 2012 4:40 am
Gender: Male
Spoken languages: English, limited Spanish

Re: Error Saving

Post by Enthalpy »

Ah, that's interesting! I'm assuming you copy-pasted it all, and didn't do the newlines manually? If so, that changes things!

For Unas:

This is such a subtle point that I missed it the first several times, but there's another thing wrong with that error message: the whitespace. There should only be one blank line between the error message and the debug text, not two. There's a natural explanation for this, but it's... screwy. For whatever reason, the xhr response led with a newline. This also resolves the puzzle of why we only got part of the error message: The regex used to define "matches" failed, so received_length was never defined, and the comparison with received_length against 0 failed as well. debug_info was never modified to include the extra characters, so only the original version showed up.

If I'm right, this gives us a new puzzle: why was the newline there in the first place? save.php (at least the version on Bitbucket) doesn't seem to have a place where a newline could appear like this. Do you have an idea?
[D]isordered speech is not so much injury to the lips that give it forth, as to the disproportion and incoherence of things in themselves, so negligently expressed. ~ Ben Jonson
User avatar
Unas
Admin / Site programmer
Posts: 8850
Joined: Tue Jul 10, 2007 4:43 pm
Gender: Male
Spoken languages: Français, English, Español
Contact:

Re: Error Saving

Post by Unas »

Wow, I didn't think about checking that ! Thanks Enth :-)

As for the reason why it's happening, it's probably due to some unexpected newline at the end of an included PHP file or something like that.
I'll have to check in more detail.
ImageImageImage
If knowledge can create problems, it is not through ignorance that we can solve them.
Si le savoir peut créer des problèmes, ce n'est pas l'ignorance qui les résoudra. ( Isaac Asimov )
Post Reply