Skip to content

Conversation

@Arkhee
Copy link
Contributor

@Arkhee Arkhee commented Sep 17, 2019

Some users (included me) noticed some kind of random behavior when checking web page : ususally the server status would not update

This is probably due to mysql server configuration regarding the size of the data which is inserted in a text field : server monitor stores the full loaded webpage, sometimes the query field is too big, even when setting "last_output" to "text" instead of "varchar", the error may depend on a mysql setting.

So since the field is varchar 255, the solution is juste to truncate the data to 255 or lower before save

Arkhee and others added 2 commits September 17, 2019 12:45
		// The update un "servers" table does not work
		// Symptom : "Last online" stays stuck on "never"
		// Reason: last_output contains the full webpage, too long for the query
		// _This may depend on mysql configuration on the server_, explaining why some have the problem or not
		// Field is 255 Chars, and request does not work anyway is loaded web page is too large in last_output
		// So force truncate to 250 or less before query
@Arkhee
Copy link
Contributor Author

Arkhee commented Sep 17, 2019

Mysql error message :
"Data too long for column 'last_output' at row 1"
Reading some reports with this error it may also be related to accent characters, not sure

@TimZ99
Copy link
Member

TimZ99 commented Sep 17, 2019

I think I prefer #765 over restricting the last_output to 255 characters. What do you think?

@Arkhee
Copy link
Contributor Author

Arkhee commented Sep 17, 2019

Ok I thought the 255 char length was a choice you made
Actually, "text" is not enough as I still have the same error, some web pages I have to check are over 220Kb
MEDIUMTEXT would fit (16Mb limit)
However, whatever the choice, since this causes a mysql error if last_output is too large, I would always truncate "last_output" to the max allowed size before executing the query, so 65000 char for TEXT for instance

Well but in the end, do we really need more that 255 chars ?

@TimZ99
Copy link
Member

TimZ99 commented Sep 17, 2019

No it wasn't it really a well thought out choice.
16mb adds up fast if you're monitoring a lot of servers. Guess we can beter keep it on 255. If requested we can always change it later.

@Arkhee
Copy link
Contributor Author

Arkhee commented Sep 17, 2019

I agree, if it's for monitoring, no use to keep a load of data. I think in most cases, in case of problem the page result would be quite short
BTW I found the mysql setting : it's sql_mode : "STRICT_TRANS_TABLES"
When this mode is not active, you have no error, just a warning :
Warning: #1265 Data truncated for column 'last_output' at row 1
And when it's active there is the blocking error above :
Data too long for column 'last_output' at row 1

@TimZ99
Copy link
Member

TimZ99 commented Sep 17, 2019

Okay I tested it and 255 is not enough. 16mb on the other hand is too much. Limiting it to 5000 char is plenty I think. 🤔 Like a basic Google header is around 1000 char.

@TimZ99 TimZ99 merged commit c655989 into phpservermon:develop Sep 17, 2019
TimZ99 pushed a commit that referenced this pull request Sep 17, 2019
Fixes #765

* // PATCH Arkhee : fix/last-online-stuck-on-never-if-webpage-too-large
  // The update un "servers" table does not work
  // Symptom : "Last online" stays stuck on "never"
  // Reason: last_output contains the full webpage, too long for the query
  // _This may depend on mysql configuration on the server_, explaining why some have the problem or not
  // Field is 255 Chars, and request does not work anyway is loaded web page is too large in last_output
  // So force truncate to 250 or less before query

* Spelling

* Update varchar to text

* Update tot 3.4.1

* Update tot 3.4.1

* Update README.rst

* Updated to 5000 characters
TimZ99 pushed a commit that referenced this pull request Sep 17, 2019
Fixes #765

* // PATCH Arkhee : fix/last-online-stuck-on-never-if-webpage-too-large
  // The update un "servers" table does not work
  // Symptom : "Last online" stays stuck on "never"
  // Reason: last_output contains the full webpage, too long for the query
  // _This may depend on mysql configuration on the server_, explaining why some have the problem or not
  // Field is 255 Chars, and request does not work anyway is loaded web page is too large in last_output
  // So force truncate to 250 or less before query

* Spelling

* Update varchar to text

* Update tot 3.4.1

* Update tot 3.4.1

* Update README.rst

* Updated to 5000 characters
TimZ99 added a commit that referenced this pull request Dec 10, 2019
Added the first part with #770. Forgot to  add it to the fresh install function.

Also removed the default value for TEXT as TEXT can't have a default value.

Co-Authored-By: Matěj Kmínek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants