1. Guest, as per the stickied thread, this forum has not been in use since 2014. All bugs and feature requests should be posted to JIRA.

Not a Bug Connections with MySQL produced crash

Discussion in 'Bugs & Feature Requests' started by mjl1010, May 21, 2014.

  1. Hi guys,

    Recently, my server is constant crashes because of some bad sintax to run the sql query, but this is false, the query is successful and the server works perfectly until suddenly suffers a crash.

    The crash-code: http://pastebin.com/q7FPh6AG

    Why must produce a crash instead of ignoring or giving a simple error of 'several'? I do not understand.

    The error is produced when execute this sql query:
    public synchronized boolean setSesion(Jugador usuario) {
            Connection con = null;
            PreparedStatement pst = null;
            try {
                java.util.Date today = new java.util.Date();
                Date date = new Date(today.getTime());
                Format formatter = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss");
                con = makeSureConnectionIsReady();
                pst = con.prepareStatement("UPDATE usuarios SET UsuarioIp=?, UsuarioFechaUltima=?, UsuarioLoginFallidos=?, UsuarioUltimoLoginFallido=? WHERE UsuarioId=?;");
                pst.setString(1, usuario.getIp());
                pst.setString(2, formatter.format(date));
                pst.setInt(3, 0);
                pst.setString(4, null);
                pst.setString(5, usuario.getUsuario());
            } catch (SQLException ex) {
                this.log.severe("[Anbu] Error en la base de datos (2.1): " + ex.getMessage());
                return false;
            } catch (MiniConnectionPoolManager.TimeoutException ex) {
                this.log.severe("[Anbu] Error en la base de datos (2.2): " + ex.getMessage());
                return false;
            finally {
            return true;
    Thanks for read and help.

    The code has no errors, works perfectly.
  2. Thinkofdeath

    Thinkofdeath Retired Developer

    The issue is that you are blocking the main thread preventing the rest of the server from working until your query completes. Spigot has a feature called 'Watchdog' which shuts down the server and prints a thread dump (like your paste) when something blocks for the set amount of time (set in spigot.yml). The issue is your plugin not spigot.