elixir-sqlite / sqlite_ecto2

Sqlite3 adapter for Ecto 2.2.x
https://hex.pm/packages/sqlite_ecto2
MIT License
120 stars 33 forks source link

`:too_many_tries` should probably be `{:stop, :too_many_tries}` #217

Closed ConnorRigby closed 5 years ago

ConnorRigby commented 6 years ago
** (stop) bad return value: :too_many_tries
Last message (from #PID<0.269.0>): {:query_rows, "DELETE FROM \"events\" WHERE \"id\" = ?1", [timeout: 15000, decode: :manual, types: true, bind: [1]]}
State: {{:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, %Sqlitex.Server.StatementCache{cached_stmts: %{"BEGIN" => %Sqlitex.Statement{column_names: [], column_types: [], database: {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, returning: nil, statement: {:statement, #Reference<0.2400134399.4188667904.147413>, {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}}}, "COMMIT" => %Sqlitex.Statement{column_names: [], column_types: [], database: {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, returning: nil, statement: {:statement, #Reference<0.2400134399.4188667904.147415>, {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}}}, "DELETE FROM \"events\" WHERE \"id\" = ?1" => %Sqlitex.Statement{column_names: [], column_types: [], database: {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, returning: nil, statement: {:statement, #Reference<0.2400134399.4188667904.148411>, {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}}}, "INSERT INTO \"events\" (\"kind\",\"payload\",\"subscriber_id\") VALUES (?1,?2,?3) ;--RETURNING ON INSERT \"events\",\"id\"" => %Sqlitex.Statement{column_names: [:"\"id\""], column_types: [nil], database: {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, returning: {"\"events\"", ["\"id\""], "INSERT", "NEW"}, statement: {:statement, #Reference<0.2400134399.4188667904.147438>, {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}}}, "PRAGMA foreign_keys" => %Sqlitex.Statement{column_names: [:foreign_keys], column_types: [nil], database: {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, returning: nil, statement: {:statement, #Reference<0.2400134399.4188667904.147384>, {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}}}, "SELECT e0.\"id\", e0.\"kind\", e0.\"subscriber_id\", e0.\"payload\" FROM \"events\" AS e0 INNER JOIN (SELECT s0.\"id\" AS \"id\", s0.\"name\" AS \"name\", s0.\"pid\" AS \"pid\", s0.\"publisher_id\" AS \"publisher_id\" FROM \"subscribers\" AS s0 INNER JOIN (SELECT p0.\"id\" AS \"id\", p0.\"name\" AS \"name\" FROM \"publishers\" AS p0 WHERE (p0.\"name\" = ?1)) AS s1 ON s0.\"publisher_id\" = s1.\"id\" WHERE (s0.\"name\" = ?2)) AS s1 ON s1.\"name\" = ?3" => %Sqlitex.Statement{column_names: [:"e0.\"id\"", :"e0.\"kind\"", :"e0.\"subscriber_id\"", :"e0.\"payload\""], column_types: [:INTEGER, :TEXT, :INTEGER, :TEXT], database: {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, returning: nil, statement: {:statement, #Reference<0.2400134399.4188667904.147414>, {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}}}, "SELECT e0.\"id\", e0.\"kind\", e0.\"subscriber_id\", e0.\"payload\", e0.\"subscriber_id\" FROM \"events\" AS e0 WHERE (e0.\"subscriber_id\" = ?1) ORDER BY e0.\"subscriber_id\"" => %Sqlitex.Statement{column_names: [:id, :kind, :subscriber_id, :payload, :subscriber_id], column_types: [:INTEGER, :TEXT, :INTEGER, :TEXT, :INTEGER], database: {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, returning: nil, statement: {:statement, #Reference<0.2400134399.4188667904.147630>, {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}}}, "SELECT p0.\"id\", p0.\"name\" FROM \"publishers\" AS p0 WHERE (p0.\"name\" = ?1)" => %Sqlitex.Statement{column_names: [:id, :name], column_types: [:INTEGER, :TEXT], database: {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, returning: nil, statement: {:statement, #Reference<0.2400134399.4188667904.147391>, {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}}}, "SELECT s0.\"id\", s0.\"name\", s0.\"pid\", s0.\"publisher_id\" FROM \"subscribers\" AS s0 INNER JOIN (SELECT p0.\"id\" AS \"id\", p0.\"name\" AS \"name\" FROM \"publishers\" AS p0 WHERE (p0.\"name\" = ?1)) AS s1 ON s0.\"publisher_id\" = s1.\"id\"" => %Sqlitex.Statement{column_names: [:"s0.\"id\"", :"s0.\"name\"", :"s0.\"pid\"", :"s0.\"publisher_id\""], column_types: [:INTEGER, :TEXT, :TEXT, :INTEGER], database: {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, returning: nil, statement: {:statement, #Reference<0.2400134399.4188667904.147600>, {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}}}, "SELECT s0.\"id\", s0.\"name\", s0.\"pid\", s0.\"publisher_id\", s0.\"id\" FROM \"subscribers\" AS s0 WHERE (s0.\"id\" = ?1)" => %Sqlitex.Statement{column_names: [:id, :name, :pid, :publisher_id, :id], column_types: [:INTEGER, :TEXT, :TEXT, :INTEGER, :INTEGER], database: {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, returning: nil, statement: {:statement, #Reference<0.2400134399.4188667904.148410>, {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}}}}, db: {:connection, #Reference<0.2400134399.4188536834.149162>, #Reference<0.2400134399.4188667906.149134>}, limit: 20, lru: ["PRAGMA foreign_keys", "SELECT p0.\"id\", p0.\"name\" FROM \"publishers\" AS p0 WHERE (p0.\"name\" = ?1)", "SELECT s0.\"id\", s0.\"name\", s0.\"pid\", s0.\"publisher_id\" FROM \"subscribers\" AS s0 INNER JOIN (SELECT p0.\"id\" AS \"id\", p0.\"name\" AS \"name\" FROM \"publishers\" AS p0 WHERE (p0.\"name\" = ?1)) AS s1 ON s0.\"publisher_id\" = s1.\"id\"", "SELECT e0.\"id\", e0.\"kind\", e0.\"subscriber_id\", e0.\"payload\", e0.\"subscriber_id\" FROM \"events\" AS e0 WHERE (e0.\"subscriber_id\" = ?1) ORDER BY e0.\"subscriber_id\"", "INSERT INTO \"events\" (\"kind\",\"payload\",\"subscriber_id\") VALUES (?1,?2,?3) ;--RETURNING ON INSERT \"events\",\"id\"", "COMMIT", "BEGIN", "SELECT e0.\"id\", e0.\"kind\", e0.\"subscriber_id\", e0.\"payload\" FROM \"events\" AS e0 INNER JOIN (SELECT s0.\"id\" AS \"id\", s0.\"name\" AS \"name\", s0.\"pid\" AS \"pid\", s0.\"publisher_id\" AS \"publisher_id\" FROM \"subscribers\" AS s0 INNER JOIN (SELECT p0.\"id\" AS \"id\", p0.\"name\" AS \"name\" FROM \"publishers\" AS p0 WHERE (p0.\"name\" = ?1)) AS s1 ON s0.\"publisher_id\" = s1.\"id\" WHERE (s0.\"name\" = ?2)) AS s1 ON s1.\"name\" = ?3", "SELECT s0.\"id\", s0.\"name\", s0.\"pid\", s0.\"publisher_id\", s0.\"id\" FROM \"subscribers\" AS s0 WHERE (s0.\"id\" = ?1)", "DELETE FROM \"events\" WHERE \"id\" = ?1"], size: 10}, 5000}
Client #PID<0.269.0> is alive

    (stdlib) gen.erl:169: :gen.do_call/4
    (elixir) lib/gen_server.ex:833: GenServer.call/3
    lib/sqlite_db_connection/protocol.ex:217: Sqlite.DbConnection.Protocol.query_rows/3
    lib/sqlite_db_connection/protocol.ex:158: Sqlite.DbConnection.Protocol.run_stmt/4
    lib/sqlite_db_connection/protocol.ex:132: Sqlite.DbConnection.Protocol.handle_execute/5
    (db_connection) lib/db_connection.ex:966: DBConnection.handle/4
    (db_connection) lib/db_connection.ex:1086: DBConnection.describe_run/5
    (db_connection) lib/db_connection.ex:1150: anonymous fn/4 in DBConnection.run_meter/5

22:15:20.774 [error] GenServer #PID<0.269.0> terminating
** (MatchError) no match of right hand side value: {:error, %Sqlite.DbConnection.Error{connection_id: nil, message: "Disconnected", sqlite: nil}}
    lib/sqlite_db_connection/protocol.ex:206: Sqlite.DbConnection.Protocol.handle_transaction/3
    (db_connection) lib/db_connection.ex:1343: DBConnection.handle/5
    (db_connection) lib/db_connection.ex:1329: DBConnection.conclude_meter/6
    (db_connection) lib/db_connection.ex:1207: DBConnection.run_begin/3
    (db_connection) lib/db_connection.ex:798: DBConnection.transaction/3
    (event_source) lib/event_source/subscription_worker.ex:16: EventSource.SubscriptionWorker.handle_info/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
Last message: :work
State: %{publisher_name: "new", subscriber_name: "huhh"}

Just dumping for now. Haven't investigated properly

ConnorRigby commented 5 years ago

This was a bug in an old version of dbconnection i think