sijms / go-ora

Pure go oracle client
MIT License
771 stars 169 forks source link

TTC error: received code N during response reading (v2.7.26) #485

Closed gfl-akovalchuk closed 7 months ago

gfl-akovalchuk commented 7 months ago

I have spent hours of googling solution for issue: "TTC error: received code N during response reading" and didn't found proper one. The only thing I know it gets worse with latest version of the library. Currently we use v2.7.17 and issue appears very rare but once I try to update library to v2.7.26 I am starting to receive a lot of error records in LOG files of application. More over - I am starting to receive errors we didn't have before. We work with multiple OUT parameters as RefCursor. For retrieving data in RefCursors we fetch records in loop. When we use v2.7.17 - everything looks fine, but once we are trying to update library to v2.7.26 - we receive mixed data from RefCursor or even starting to receive columns with names that are not commonly returning by stored procedure. And this happens on latest version of the library. I don't have time to test all versions from 17 to 26 but I believe there is something wrong with v2.7.26. Once I get back 2.7.17 - no more hundred records of error in LOGs appear.

What we use:

  1. stored procedures that return multiple RefCursors
  2. I tried to change "PREFETCH_ROW" - from 10 to 1000 (very unstable on 2.7.26 and 2.7.17 works stable enough with value = 20)
  3. we use "sqlx.DB.Exec" for executing query with stored procedure
  4. We use "go_ora.WrapRefCursor" and "sqlx.StructScan" for fetching records into structures.
sijms commented 7 months ago

this error is related to #480 and the cause of them is network data loss i am working on to fix it

sijms commented 7 months ago

fixed v2.8.0 would you please test and tell me if any issue happen

gfl-akovalchuk commented 7 months ago

fixed v2.8.0 would you please test and tell me if any issue happen

Thank you! Sure, will do.

sijms commented 7 months ago

go to v2.8.1

gfl-akovalchuk commented 7 months ago

go to v2.8.1

Hopefully it will not be increased every hour.

gfl-akovalchuk commented 7 months ago

ok, at first glance it looks fine. But let me finish all my tests before(It may take couple of days) Thank you

gfl-akovalchuk commented 7 months ago

@sijms I had to stop testing this fix since new version 2.8.0 & 2.8.1 brings another issue with parsing DB rows(unsupported go type: )

sijms commented 7 months ago

would you please explain the new issue. which go type is not supported

gfl-akovalchuk commented 7 months ago

@sijms good question. The SQL query that is working fine on 2.7.17 just stops to work on 2.8.+

Db.ExecContext(ctx, query, arguments...)

where "query" is the following:

begin x.X_DATA_PKG.GET_DATA( RC => :1, RES => :2, RC => :3, RCL => :4, BDATE => TO_DATE(:5, 'MM-DD-YYYY'), EDATE => TO_DATE(:6, 'MM-DD-YYYY'), FLAG => :7, RES_OUT => :8, STATUS => :9, MESSAGE => :10 ); end;

and "arguments" are: image

Full error message says "unsupported go type: " there is nothing more that can explain what type is it.

gfl-akovalchuk commented 7 months ago

@sijms I have finished debugging - command.go

image

it says first parameter *string="ra" err = "unsupported go type: "

The issue with function "setDataType" of "parameter_encode.go" "switch" statement "default:" case 2.7.17 has the following logic:

image

after that point parameter will be qualified as image

when 2.8.+ will end up with error

sijms commented 7 months ago

fixed in v2.8.2