On Monday, September 21, 2015 at 11:22:08 PM UTC-7, Petr Kaleta wrote:
>
> Last few days I am receiving on Heroku this two errors:
>
> Sequel::DatabaseDisconnectError: Java::OrgPostgresqlUtil::PSQLException: This
> connection has been closed.
> File
> "org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(org/postgresql/jdbc2/AbstractJdbc2Connection.java",
> line 820
> File
> "org.postgresql.jdbc3.AbstractJdbc3Connection.createStatement(org/postgresql/jdbc3/AbstractJdbc3Connection.java",
> line 231
> File
> "org.postgresql.jdbc2.AbstractJdbc2Connection.createStatement(org/postgresql/jdbc2/AbstractJdbc2Connection.java",
> line 286
> File "java.lang.reflect.Method.invoke(java/lang/reflect/Method.java", line
> 497
> File
> "RUBY.statement(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/adapters/jdbc.rb",
> line 657
> File
> "RUBY.execute(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/adapters/jdbc.rb",
> line 246
> File
> "Sequel::ThreadedConnectionPool.hold(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb",
> line 103
> File
> "Sequel::ThreadedConnectionPool.hold(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb",
> line 103
> File
> "Sequel::ThreadedConnectionPool.hold(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb",
> line 101
> File
> "Sequel::ThreadedConnectionPool.hold(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb",
> line 101
> File
> "Sequel::Database.synchronize(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/database/connecting.rb",
> line 254
> File
> "Sequel::Database.synchronize(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/database/connecting.rb",
> line 254
> File
> "RUBY.execute(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/adapters/jdbc.rb",
> line 245
> File
> "RUBY.execute(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/dataset/actions.rb",
> line 921
> File
> "RUBY.fetch_rows(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/adapters/jdbc.rb",
> line 721
> File
> "RUBY.with_sql_each(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/dataset/actions.rb",
> line 802
> File
> "RUBY.with_sql_all(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/dataset/actions.rb",
> line 785
> File
> "RUBY._all(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/dataset/actions.rb",
> line 861
> File
> "RUBY.with_sql_all(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/dataset/actions.rb",
> line 785
> File
> "RUBY.all(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/dataset/placeholder_literalizer.rb",
> line 138
> File
> "RUBY._load_associated_object_array(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/model/associations.rb",
> line 2131
> File
> "RUBY._load_associated_objects(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/model/associations.rb",
> line 2142
> File
> "RUBY.load_associated_objects(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/model/associations.rb",
> line 2240
> File
> "RUBY.media(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/model/associations.rb",
> line 1767
>
>
>
The first one is correctly recognized as a disconnect error.
> and here's the second one:
>
> Sequel::DatabaseError: Java::OrgPostgresqlUtil::PSQLException: An I/O error
> occurred while sending to the backend.
> File
> "org.postgresql.core.v3.QueryExecutorImpl.execute(org/postgresql/core/v3/QueryExecutorImpl.java",
> line 283
> File
> "org.postgresql.jdbc2.AbstractJdbc2Statement.execute(org/postgresql/jdbc2/AbstractJdbc2Statement.java",
> line 570
> File
> "org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(org/postgresql/jdbc2/AbstractJdbc2Statement.java",
> line 406
> File
> "org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(org/postgresql/jdbc2/AbstractJdbc2Statement.java",
> line 286
> File "java.lang.reflect.Method.invoke(java/lang/reflect/Method.java", line
> 497
> File
> "RUBY.execute(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/adapters/jdbc.rb",
> line 251
> File
> "RUBY.log_yield(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/database/logging.rb",
> line 33
> File
> "RUBY.log_yield(/app/vendor/bundle/jruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/sequel/extensions/newrelic_instrumentation.rb",
> line 45
> File
> "NewRelic::Agent::MethodTracer.trace_execution_scoped(/app/vendor/bundle/jruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/new_relic/agent/method_tracer.rb",
> line 73
> File
> "NewRelic::Agent::MethodTracer.trace_execution_scoped(/app/vendor/bundle/jruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/new_relic/agent/method_tracer.rb",
> line 73
> File
> "NewRelic::Agent::MethodTracerHelpers.trace_execution_scoped(/app/vendor/bundle/jruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/new_relic/agent/method_tracer_helpers.rb",
> line 82
> File
> "NewRelic::Agent::MethodTracerHelpers.trace_execution_scoped(/app/vendor/bundle/jruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/new_relic/agent/method_tracer_helpers.rb",
> line 82
> File
> "NewRelic::Agent::MethodTracerHelpers.trace_execution_scoped(/app/vendor/bundle/jruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/new_relic/agent/method_tracer_helpers.rb",
> line 81
> File
> "NewRelic::Agent::MethodTracerHelpers.trace_execution_scoped(/app/vendor/bundle/jruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/new_relic/agent/method_tracer_helpers.rb",
> line 81
> File
> "NewRelic::Agent::MethodTracer.trace_execution_scoped(/app/vendor/bundle/jruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/new_relic/agent/method_tracer.rb",
> line 71
> File
> "NewRelic::Agent::MethodTracer.trace_execution_scoped(/app/vendor/bundle/jruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/new_relic/agent/method_tracer.rb",
> line 71
> File
> "RUBY.log_yield(/app/vendor/bundle/jruby/1.9/gems/newrelic_rpm-3.13.0.299/lib/sequel/extensions/newrelic_instrumentation.rb",
> line 42
> File
> "RUBY.execute(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/adapters/jdbc.rb",
> line 251
> File
> "RUBY.statement(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/adapters/jdbc.rb",
> line 658
> File
> "RUBY.execute(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/adapters/jdbc.rb",
> line 246
> File
> "Sequel::ThreadedConnectionPool.hold(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb",
> line 103
> File
> "Sequel::ThreadedConnectionPool.hold(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb",
> line 103
> File
> "Sequel::ThreadedConnectionPool.hold(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb",
> line 101
> File
> "Sequel::ThreadedConnectionPool.hold(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb",
> line 101
> File
> "Sequel::Database.synchronize(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/database/connecting.rb",
> line 254
> File
> "Sequel::Database.synchronize(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/database/connecting.rb",
> line 254
> File
> "RUBY.execute(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/adapters/jdbc.rb",
> line 245
> File
> "RUBY.execute(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/dataset/actions.rb",
> line 921
> File
> "RUBY.fetch_rows(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/adapters/jdbc.rb",
> line 721
> File
> "RUBY.primary_key_lookup(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/model/base.rb",
> line 1045
> File
> "RUBY.with_pk(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/model/base.rb",
> line 783
> File
> "RUBY.with_pk!(/app/vendor/bundle/jruby/1.9/gems/sequel-4.26.0/lib/sequel/model/base.rb",
> line 788
>
>
> Any idea where it can come from? Its happening just on one of our
> instances...
>
The second one is not recognized as a disconnect error. Here's a patch that
should fix that:
index 5a297eb..3ac609b 100644
--- a/lib/sequel/adapters/jdbc/postgresql.rb
+++ b/lib/sequel/adapters/jdbc/postgresql.rb
@@ -135,7 +135,7 @@ module Sequel
end
def disconnect_error?(exception, opts)
- super || exception.message =~ /\AThis connection has been
closed\.\z|\AFATAL: terminating connection due to administrator command\z/
+ super || exception.message =~ /\A(This connection has been
closed\.|FATAL: terminating connection due to administrator command|An I/O
error occurred while sending to the backend\.)\z/
end
# Use setNull for nil arguments as the default behavior of
setString
As to why it is happening, it could be that your application is losing a
connection to the database due to network issues. You can use the
connection_validator extension if you want to check connections for
validity before use.
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.