JDBC can't connect anymore for no apparent reason

I keep getting this error:

[2018-01-06T14:53:40,534][ERROR][logstash.inputs.jdbc ] Java::OrgPostgresqlUtil::PSQLException: An I/O error occurred while sending to the backend.: SELECT count(*) AS "count" FROM (SELECT * from tracking WHERE id > 159000000 ORDER BY id) AS "t1" LIMIT 1
[2018-01-06T14:53:40,537][WARN ][logstash.inputs.jdbc ] Exception when executing JDBC query {:exception=>#<Sequel::DatabaseDisconnectError: Java::OrgPostgresqlUtil::PSQLException: An I/O error occurred while sending to the backend.>}

I didn't change any credentials for the database, and when I check the status on AWS it says it's fine and up and running.

Edit: I stopped Logstash and restarted it but it still gave me this error right away. I evidently had to wait for a bit and restarting worked. Shouldn't Logstash see this connection and just restart it or something automatically?

Moved discussion to here Why does Logstash not restart from JDBC I/O errors?