oracle / odpi

ODPI-C: Oracle Database Programming Interface for Drivers and Applications
https://oracle.github.io/odpi/
Other
268 stars 78 forks source link

1000+ Valgrind Error #29

Closed Taymindis closed 7 years ago

Taymindis commented 7 years ago

==27524== Use of uninitialised value of size 8 ==27524== at 0x9D3DE91: r0_des_encp_k8_64 (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== by 0x9D13958: r0_cipher_cbc8lup_enc (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== by 0x9D13C3B: r0_cipher_cbc8lup (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== by 0x9D13C7A: R1_CIPH_CTX_cipher (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== by 0x9CFEB89: r_ck_cipher_update (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== by 0x9BF6DFB: ztca_RSAAdpEncrypt (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== by 0x9E36FA4: ztcebn (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== by 0x9E360C8: ztcecrypto_2 (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== by 0x9BDEE0B: ztceenc (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== by 0x9BF8914: ztcrbm (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== by 0x9BF838F: ztcrbh (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== by 0x9BF8136: ztcrbp (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== Uninitialised value was created by a stack allocation ==27524== at 0x9BF8586: ztcrsg (in /opt/oracle/instantclient_12_2/libnnz12.so) ==27524== ==27524== ==27524== More than 1000 different errors detected. I'm not reporting any more. ==27524== Final error counts will be inaccurate. Go fix your program! ==27524== Rerun with --error-limit=no to disable this cutoff. Note ==27524== that errors may occur in your program without prior warning from ==27524== Valgrind, because errors are no longer being displayed. ==27524== Done. ==27524== ==27524== HEAP SUMMARY: ==27524== in use at exit: 1,228,491 bytes in 368 blocks ==27524== total heap usage: 2,725 allocs, 2,357 frees, 2,084,971 bytes allocated ==27524== ==27524== 43 bytes in 1 blocks are definitely lost in loss record 100 of 298 ==27524== at 0x4C29BE3: malloc (vg_replace_malloc.c:299) ==27524== by 0xB46A115: slzsetevar (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB46E4DA: lfvSetOHome (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB33EB3C: slpmloclfv (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB33E6A1: slpmloc (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB33C047: lpmloadpkg (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31E09A: lfvLoadPkg (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31DD45: lfvSetShlMode (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31D73F: lfvini1 (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31D384: lfvinit (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0x63BD768: kpummpin (in /opt/oracle/instantclient_12_2/libclntsh.so.12.1) ==27524== by 0x5E486A3: kpuenvcr (in /opt/oracle/instantclient_12_2/libclntsh.so.12.1) ==27524== ==27524== 192 bytes in 1 blocks are possibly lost in loss record 203 of 298 ==27524== at 0x4C29BE3: malloc (vg_replace_malloc.c:299) ==27524== by 0xB31755E: sltsmxi (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB3380F6: lmmhpinit (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB336FD6: lmmcis (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB33C589: lpmpali (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB33B7F7: lpminitm (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31E041: lfvLoadPkg (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31DD45: lfvSetShlMode (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31D73F: lfvini1 (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31D384: lfvinit (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0x63BD768: kpummpin (in /opt/oracle/instantclient_12_2/libclntsh.so.12.1) ==27524== by 0x5E486A3: kpuenvcr (in /opt/oracle/instantclient_12_2/libclntsh.so.12.1) ==27524== ==27524== 192 bytes in 1 blocks are possibly lost in loss record 204 of 298 ==27524== at 0x4C29BE3: malloc (vg_replace_malloc.c:299) ==27524== by 0xB31755E: sltsmxi (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB3380F6: lmmhpinit (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB336FD6: lmmcis (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB33C589: lpmpali (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB33C13C: lpmloadpkg (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31E09A: lfvLoadPkg (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31DD45: lfvSetShlMode (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31D73F: lfvini1 (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31D384: lfvinit (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0x63BD768: kpummpin (in /opt/oracle/instantclient_12_2/libclntsh.so.12.1) ==27524== by 0x5E486A3: kpuenvcr (in /opt/oracle/instantclient_12_2/libclntsh.so.12.1) ==27524== ==27524== 139,264 bytes in 1 blocks are possibly lost in loss record 297 of 298 ==27524== at 0x4C29BE3: malloc (vg_replace_malloc.c:299) ==27524== by 0xB33AB14: lmmstvrt (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB339585: lmmstchnk (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB33A909: lmmstsml (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB55516E: lmmstmalloc (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB554885: lmmmalloc (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB336EC5: lmmcis (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB33C589: lpmpali (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB33B7F7: lpminitm (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31E041: lfvLoadPkg (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31DD45: lfvSetShlMode (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== by 0xB31D73F: lfvini1 (in /opt/oracle/instantclient_12_2/libclntshcore.so.12.1) ==27524== ==27524== LEAK SUMMARY: ==27524== definitely lost: 43 bytes in 1 blocks ==27524== indirectly lost: 0 bytes in 0 blocks ==27524== possibly lost: 139,648 bytes in 3 blocks ==27524== still reachable: 1,088,800 bytes in 364 blocks ==27524== suppressed: 0 bytes in 0 blocks ==27524== Reachable blocks (those to which a pointer was found) are not shown. ==27524== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==27524== ==27524== For counts of detected and suppressed errors, rerun with: -v ==27524== ERROR SUMMARY: 1129 errors from 1004 contexts (suppressed: 0 from 0) -bash-4.2$

anthony-tuininga commented 7 years ago

Can you specify how you got this report? Which application did you run?

Taymindis commented 7 years ago

I'm running on Redhat Linux OS Maipo, I just simple compile the one of the sample. For example, gcc -I../Include SampleLib.c TestConvertNumber.c -lodpic -ldl then valgrind --leak-check=full --track-origins=yes ./a.out

kubo commented 7 years ago

Some errors are related to ODPI-C. It tends to forget to allocate additional one byte for nul terminator.

However some errors are related to Oracle libraries. They should be suppressed by a suppression file because ODPI-C cannot fix them. http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress

cjbj commented 7 years ago

In particular, suppress all the zt* errors.

Valgrind isn't so good with the non-gcc generated binaries that Oracle builds.

anthony-tuininga commented 7 years ago

Some errors are related to ODPI-C. It tends to forget to allocate additional one byte for nul terminator.

Do you know where these are? I'd happily fix them!

Would it be helpful to ship a Valgrind suppression file? I have one I use internally, for example.

Taymindis commented 7 years ago

Attached the full valgrind Report for TestConvertNumber.c . However, our dev team will on hold for this issue fixed, debug line number attached for easier look.

output.txt

cjbj commented 7 years ago

@Taymindis if you have an identified ODPI error, please report it. Other valgrind errors in layers beneath ODPI are unlikely to be 'fixed'. I once spent a long time logging bugs on similar issues. When examined by the relevant developers, most were due to the valgrind not dealing correctly with the compiler used by Oracle. I also have a suspicion (with no proof) that some of the zt output is a deliberate way to increase entropy.

Taymindis commented 7 years ago

@cjbj

This is the part of the test file issue ==18314== ==18314== ==18314== 1 errors in context 11 of 280: ==18314== Invalid read of size 1 ==18314== at 0x401245: dpiSamplesgetEnvValue (SampleLib.c:58) ==18314== by 0x4014BC: dpiSamples_getParams (SampleLib.c:136) ==18314== by 0x401261: dpiSamples_getConn (SampleLib.c:77) ==18314== by 0x400ECA: main (TestConvertNumbers.c:64) ==18314== Address 0x570f2cd is 0 bytes after a block of size 13 alloc'd ==18314== at 0x4C29BE3: malloc (vg_replace_malloc.c:299) ==18314== by 0x4011D1: dpiSamplesgetEnvValue (SampleLib.c:52) ==18314== by 0x4014BC: dpiSamples_getParams (SampleLib.c:136) ==18314== by 0x401261: dpiSamples_getConn (SampleLib.c:77) ==18314== by 0x400ECA: main (TestConvertNumbers.c:64) ==18314== ==18314== ==18314== 1 errors in context 12 of 280: ==18314== Invalid read of size 1 ==18314== at 0x401245: dpiSamplesgetEnvValue (SampleLib.c:58) ==18314== by 0x40145F: dpiSamples_getParams (SampleLib.c:130) ==18314== by 0x401261: dpiSamples_getConn (SampleLib.c:77) ==18314== by 0x400ECA: main (TestConvertNumbers.c:64) ==18314== Address 0x570f158 is 0 bytes after a block of size 8 alloc'd ==18314== at 0x4C29BE3: malloc (vg_replace_malloc.c:299) ==18314== by 0x4011D1: dpiSamplesgetEnvValue (SampleLib.c:52) ==18314== by 0x40145F: dpiSamples_getParams (SampleLib.c:130) ==18314== by 0x401261: dpiSamples_getConn (SampleLib.c:77) ==18314== by 0x400ECA: main (TestConvertNumbers.c:64) ==18314== ==18314== ==18314== 1 errors in context 13 of 280: ==18314== Invalid read of size 1 ==18314== at 0x401245: dpiSamplesgetEnvValue (SampleLib.c:58) ==18314== by 0x401421: dpiSamples_getParams (SampleLib.c:126) ==18314== by 0x401261: dpiSamples_getConn (SampleLib.c:77) ==18314== by 0x400ECA: main (TestConvertNumbers.c:64) ==18314== Address 0x570f0b7 is 0 bytes after a block of size 7 alloc'd ==18314== at 0x4C29BE3: malloc (vg_replace_malloc.c:299) ==18314== by 0x4011D1: dpiSamplesgetEnvValue (SampleLib.c:52) ==18314== by 0x401421: dpiSamples_getParams (SampleLib.c:126) ==18314== by 0x401261: dpiSamples_getConn (SampleLib.c:77) ==18314== by 0x400ECA: main (TestConvertNumbers.c:64)

anthony-tuininga commented 7 years ago

That particular issue was discovered in the test suite and pushed earlier today. I have just done the same for the samples.

Taymindis commented 7 years ago

@anthony-tuininga @cjbj I have shrink down the report by using DRMemory. I think you have more clear about the error is, only 7 Errors. drmemoryReport.txt

anthony-tuininga commented 7 years ago

Did you do a pull to get the latest changes to the samples? That should correct the issues on top. The other ones may not be fixable. The full call stack isn't found either. Can you increase that somehow? Valgrind has the option --num-callers to address that.

Taymindis commented 7 years ago

@anthony-tuininga Yes, i did, odpi has no bug or error now. I have sync test with OCI interface(OCI). Both are having same lib error. However, I need to confirm with my team this 7 unique error are commons. It won't be affect the application.

kubo commented 7 years ago

Valgrind isn't so good with the non-gcc generated binaries that Oracle builds.

Thanks. I suspected that valgrind might complains due to intel C compiler.

Do you know where these are? I'd happily fix them!

I found two positions. But sorry, one is different from what I thought. It was already fixed. The other is oracleHomeLibNameLength in dpiOci__loadLib(). It needs more one byte.

Would it be helpful to ship a Valgrind suppression file? I have one I use internally, for example.

It is helpful not only for me, I think.

anthony-tuininga commented 7 years ago

@anthony-tuininga Yes, i did, odpi has no bug or error now. I have sync test with OCI interface(OCI). Both are having same lib error. However, I need to confirm with my team this 7 unique error are commons. It won't be affect the application.

Thanks, @Taymindis. Please close this issue when you have confirmed with your team.

Thanks, @kubo. I have added the extra byte for the ORACLE_HOME library path, as suggested.