Create.html file sometimes fails to load

Our users have noticed that Create.html files won’t load sometimes. But after some refreshes it works normal. This happened two days ago and i checked for my logs and did not see any error look on June 20th. In the past month this has happened four times. This is the logs:
[8528] [Sat Jun 21 06:40:26 2025] [error]: DBD::mysql::st execute failed: Server has gone away at /opt/rt5/share/html/Ticket/Create.html line 1136.
[8514] [Sat Jun 21 06:43:58 2025] [error]: DBD::mysql::st execute failed: Server has gone away at /opt/rt5/share/html/Ticket/Create.html line 1136.
[8519] [Sat Jun 21 06:54:16 2025] [error]: DBD::mysql::st execute failed: Server has gone away at /opt/rt5/share/html/Ticket/Create.html line 1060

and the line is this:
my $dbh = RT::Handle->dbh;

    my $CurrentUser = $session{"CurrentUser"};
    my $uid = $CurrentUser->id;

    my $sth = $dbh->prepare(q{
        SELECT cnt
        FROM user_daily_ticket_count
        WHERE user_id = ? 
        AND day_date = ?
    });
    $sth->execute($uid, $yyyy_mm_dd);
    my ($today_count) = $sth->fetchrow_array;
    $sth->finish;

    $today_count ||= 0;