Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent disconnected error #185

Open
maartenJacobs opened this issue Jan 13, 2025 · 3 comments
Open

Intermittent disconnected error #185

maartenJacobs opened this issue Jan 13, 2025 · 3 comments

Comments

@maartenJacobs
Copy link

About once a day we are seeing errors like Jamdb.Oracle (#PID<0.26605.35>) disconnected: ** (DBConnection.ConnectionError) {:normal, {:gen_server, :call, [#PID<0.26605.35>, {:sql_query, {~c"...query...", []}, 15000}, 15000]}}. I'm trying to find out why the error happens, even if it's a socket being randomly disconnected.

Is there any way to get the reason for the error in the message? Not sure if https://github.com/erlangbureau/jamdb_oracle/blob/master/src/jamdb_oracle.erl#L55 is related but it looks like the reason of the error is ignored.

@vstavskyi
Copy link
Member

The error handling is minimally implemented because of the "Let It Crash" philosophy.

@maartenJacobs
Copy link
Author

Discarding the error doesn't seem to fit that philosophy though 😅

I forked this repo and replaced the try-catch with just match, and got this error today. Previously I was just getting {:normal, ...} and have never seen this error before.

{:function_clause,
 [
   {:jamdb_oracle_tns_decoder, :lnxneg, [[]],
    [file: ~c"src/jamdb_oracle_tns_decoder.erl", line: 535]},
   {:jamdb_oracle_tns_decoder, :lnxneg, 1,
    [file: ~c"src/jamdb_oracle_tns_decoder.erl", line: 536]},
   {:jamdb_oracle_tns_decoder, :lnxfmt, 1,
    [file: ~c"src/jamdb_oracle_tns_decoder.erl", line: 539]},
   {:jamdb_oracle_tns_decoder, :decode_number, 1,
    [file: ~c"src/jamdb_oracle_tns_decoder.erl", line: 508]},
   {:jamdb_oracle_tns_decoder, :decode_data, 2,
    [file: ~c"src/jamdb_oracle_tns_decoder.erl", line: 406]},
   {:jamdb_oracle_tns_decoder, :decode_rxd, 6,
    [file: ~c"src/jamdb_oracle_tns_decoder.erl", line: 332]},
   {:jamdb_oracle_tns_decoder, :decode_token, 3,
    [file: ~c"src/jamdb_oracle_tns_decoder.erl", line: 176]},
   {:jamdb_oracle_conn, :handle_resp, 3, [file: ~c"src/jamdb_oracle_conn.erl", line: 279]}
 ]}

How about logging the reason for the exit? I would submit a pull request but my knowledge of Erlang is pretty poor.

@vstavskyi
Copy link
Member

Ideal conditions:

  1. all fields in queries are specified, symbol * is not used
  2. overall size of request is smaller 8000 bytes
  3. size of each parameter in request is smaller 4000 bytes
  4. overall size of response (resultset) is smaller 8000 bytes
  5. size of each field in response is smaller 4000 bytes

Error conditions:

  1. long response time from server
  2. large response from server, driver cannot decode the response
  3. decoding of datatype is not implemented in driver

erlang:display may be used to debug a part of code, but some errors can no longer be caught :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants