? ? ? ? 今天做測試時(shí)扫倡,偶然發(fā)現(xiàn)一個(gè)罕見的錯(cuò)誤。在移動端給按鈕綁定點(diǎn)擊事件竟纳,事件發(fā)生時(shí)會調(diào)用后臺接口撵溃,對數(shù)據(jù)庫進(jìn)行數(shù)據(jù)插入操作。當(dāng)極快地連續(xù)兩次點(diǎn)擊按鈕后锥累,后臺返回錯(cuò)誤信息如下:
圖1-后臺返回的報(bào)錯(cuò)信息.png
? ? ? ? 文字信息如下:
保存失敗缘挑,原因是
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
The last packet successfully received from the server was 70,520,947 milliseconds ago.
The last packet sent successfully to the server was 70,520,949 milliseconds ago. is longer than the server configured value of wait_timeout .
You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property autoReconnect=true to avoid this problem.
? ? ? ? 身為英語渣渣的我只能找有道,明白了其大致意思:
圖2-錯(cuò)誤信息渣翻.png
? ? ? ? 這個(gè)問題是后臺服務(wù)器設(shè)置所致桶略,如果前端寶寶們遇到類似的情況语淘,可找后端人員進(jìn)行溝通。再者际歼,此問題很少見惶翻,一般好像也可忽略。
? ? ? ? 最后說一下關(guān)于用戶短時(shí)間內(nèi)頻繁操作而造成多次調(diào)用后臺接口以致數(shù)據(jù)庫無效數(shù)據(jù)過多以及壓力過大問題鹅心。可根據(jù)實(shí)際情況設(shè)置標(biāo)志位為1吕粗,當(dāng)用戶在第一次點(diǎn)擊調(diào)用后,將標(biāo)志位置為0旭愧,等到第一次請求成功時(shí)(即在ajax的回調(diào)函數(shù)中可以進(jìn)行操作時(shí))將其再置為1颅筋。關(guān)于這類情況之后會做一個(gè)詳細(xì)的整理虐秋,在此不再贅述。
? ? ? ?以上垃沦。