Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ORA-08402: error executing PL/SQL code coverage #1097

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

Closed
geriweg opened this issue Sep 4, 2020 · 11 comments · Fixed by #1184
Closed

ORA-08402: error executing PL/SQL code coverage #1097

geriweg opened this issue Sep 4, 2020 · 11 comments · Fixed by #1184
Assignees
Labels
Milestone

Comments

@geriweg
Copy link

geriweg commented Sep 4, 2020

Describe the bug
Running with UT_COVERAGE_HTML_REPORTER reporter from utplsql-cli throws oracle error.
The normal UT_DOCUMENTATION_REPORTER runs all testcases successfully.

Provide version info
12.2.0.1.0
12.2.0

PL/SQL procedure successfully completed.

UT_VERSION
v3.1.10.3349

BANNER CON_ID


Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 0
PL/SQL Release 12.2.0.1.0 - Production 0
CORE 12.2.0.1.0 Production 0
TNS for Linux: Version 12.2.0.1.0 - Production 0
NLSRTL Version 12.2.0.1.0 - Production 0

PARAMETER VALUE


NLS_LANGUAGE ENGLISH
NLS_TERRITORY AUSTRIA
NLS_CURRENCY ¿
NLS_ISO_CURRENCY AUSTRIA
NLS_NUMERIC_CHARACTERS ,.
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD.MM.RR HH24:MI:SS
NLS_DATE_LANGUAGE ENGLISH
NLS_SORT BINARY
NLS_TIME_FORMAT HH24:MI:SSXFF
NLS_TIMESTAMP_FORMAT DD.MM.RR HH24:MI:SSXFF

PARAMETER VALUE


NLS_TIME_TZ_FORMAT HH24:MI:SSXFF TZR
NLS_TIMESTAMP_TZ_FORMAT DD.MM.RR HH24:MI:SSXFF TZR
NLS_DUAL_CURRENCY ¿
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE

17 rows selected.

PORT_STRING
x86_64/Linux 2.4.xx

Information about client software
utplsql-cli

$ ./utplsql info utPLSQL-cli 3.1.8-SNAPSHOT.local utPLSQL-java-api 3.1.8.546

Additional context
2020-09-04 11:57:08 [main] INFO org.utplsql.cli.RunAction -
############################ utPLSQL cli #############################
utPLSQL-cli 3.1.8-SNAPSHOT.local #
utPLSQL-java-api 3.1.8.546 #
Java-Version: 1.8.0_201 #
ORACLE_HOME: ############################## #
NLS_LANG: AMERICAN_AMERICA.UTF8 #
#
Thanks for testing! #
#
######################################################################
2020-09-04 11:57:08 [main] INFO org.utplsql.cli.RunAction -
2020-09-04 11:57:09 [main] DEBUG o.u.c.d.TestedDataSourceProvider - NLS settings: BEGIN
EXECUTE IMMEDIATE q'[ALTER SESSION SET NLS_LANGUAGE='AMERICAN']';
EXECUTE IMMEDIATE q'[ALTER SESSION SET NLS_TERRITORY='AMERICA']';
END;
2020-09-04 11:57:09 [main] INFO o.u.c.d.TestedDataSourceProvider - Use connection string jdbc:oracle:thin:/@***
2020-09-04 11:57:10 [main] INFO org.utplsql.cli.RunAction - Successfully connected to database. UtPLSQL core: v3.1.10.3349
2020-09-04 11:57:10 [main] INFO org.utplsql.cli.RunAction - Oracle-Version: 12.2.0.1.0
2020-09-04 11:57:10 [main] DEBUG org.utplsql.api.reporter.Reporter - Database-reporter initialized, Type: UT_COVERAGE_HTML_REPORTER, ID: AE7AE470E70F3B7AE0530101007FF44E
2020-09-04 11:57:10 [pool-1-thread-1] INFO org.utplsql.cli.RunTestRunnerTask - Running tests now.
2020-09-04 11:57:10 [pool-1-thread-1] INFO org.utplsql.cli.RunTestRunnerTask - --------------------------------------
2020-09-04 11:57:10 [pool-1-thread-1] INFO org.utplsql.api.TestRunner - TestRunner initialized
2020-09-04 11:57:10 [pool-1-thread-1] INFO org.utplsql.api.TestRunner - Running on utPLSQL v3.1.10.3349
2020-09-04 11:57:10 [pool-1-thread-1] INFO org.utplsql.api.TestRunner - Initializing reporters
2020-09-04 11:57:10 [pool-1-thread-1] INFO org.utplsql.api.TestRunner - Running tests
ORA-08402: error executing PL/SQL code coverage
ORA-06512: at "UT3.UT_RUNNER", line 180
ORA-06512: at "SYS.DBMS_PLSQL_CODE_COVERAGE", line 148
ORA-06512: at "UT3.UT_COVERAGE_HELPER_BLOCK", line 45
ORA-06512: at "UT3.UT_COVERAGE", line 221
ORA-06512: at "UT3.UT_COVERAGE_HTML_REPORTER", line 34
ORA-06512: at "UT3.UT_REPORTER_BASE", line 193
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 70
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 80
ORA-06512: at "UT3.UT_RUN", line 74
ORA-06512: at "UT3.UT_SUITE_ITEM", line 49
ORA-06512: at "UT3.UT_RUNNER", line 172
ORA-06512: at line 1

java.sql.SQLException: ORA-08402: error executing PL/SQL code coverage
ORA-06512: at "UT3.UT_RUNNER", line 180
ORA-06512: at "SYS.DBMS_PLSQL_CODE_COVERAGE", line 148
ORA-06512: at "UT3.UT_COVERAGE_HELPER_BLOCK", line 45
ORA-06512: at "UT3.UT_COVERAGE", line 221
ORA-06512: at "UT3.UT_COVERAGE_HTML_REPORTER", line 34
ORA-06512: at "UT3.UT_REPORTER_BASE", line 193
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 70
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 80
ORA-06512: at "UT3.UT_RUN", line 74
ORA-06512: at "UT3.UT_SUITE_ITEM", line 49
ORA-06512: at "UT3.UT_RUNNER", line 172
ORA-06512: at line 1

    at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:509)
    at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:461)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1104)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:550)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:655)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:265)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:86)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:965)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1205)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3666)
    at oracle.jdbc.driver.T4CCallableStatement.executeInternal(T4CCallableStatement.java:1358)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3778)
    at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4251)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1081)
    at org.utplsql.api.testRunner.DynamicTestRunnerStatement.execute(DynamicTestRunnerStatement.java:84)
    at org.utplsql.api.TestRunner.run(TestRunner.java:213)
    at org.utplsql.cli.RunTestRunnerTask.call(RunTestRunnerTask.java:45)
    at org.utplsql.cli.RunTestRunnerTask.call(RunTestRunnerTask.java:24)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Caused by: Error : 8402, Position : 0, Sql = BEGIN ut_runner.run(a_paths => :1 , a_reporters => :2 , a_color_console => (case :3 when 1 then true else false end), a_fail_on_errors => (case :4 when 1 then true else false end), a_client_character_set => :5 , a_random_test_order => (case :6 when 1 then true else false end));END;, OriginalSql = BEGIN ut_runner.run(a_paths => ?, a_reporters => ?, a_color_console => (case ? when 1 then true else false end), a_fail_on_errors => (case ? when 1 then true else false end), a_client_character_set => ?, a_random_test_order => (case ? when 1 then true else false end));END;, Error Msg = ORA-08402: error executing PL/SQL code coverage
ORA-06512: at "UT3.UT_RUNNER", line 180
ORA-06512: at "SYS.DBMS_PLSQL_CODE_COVERAGE", line 148
ORA-06512: at "UT3.UT_COVERAGE_HELPER_BLOCK", line 45
ORA-06512: at "UT3.UT_COVERAGE", line 221
ORA-06512: at "UT3.UT_COVERAGE_HTML_REPORTER", line 34
ORA-06512: at "UT3.UT_REPORTER_BASE", line 193
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 70
ORA-06512: at "UT3.UT_EVENT_MANAGER", line 80
ORA-06512: at "UT3.UT_RUN", line 74
ORA-06512: at "UT3.UT_SUITE_ITEM", line 49
ORA-06512: at "UT3.UT_RUNNER", line 172
ORA-06512: at line 1

    at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:513)
    ... 22 more
@geriweg
Copy link
Author

geriweg commented Sep 4, 2020

I did some further tests;

Looks like this expression causes the reporter to crash:

		BEGIN
			DBMS_STATS.GATHER_TABLE_STATS (
				ownname          => '***',      -- schema  is the same of test code and code under test
				tabname          => '***',
				cascade          => TRUE,
				degree           => 4
			);
		END;

@jgebal
Copy link
Member

jgebal commented Sep 4, 2020

I saw the same issue in one of projects at work.
It's an oracle bug.
Coverage doesn't work when tested code calls gather stats package.

I can only provide a workaround (ignore error)
That way you will get line coverage but without statement coverage.

@geriweg
Copy link
Author

geriweg commented Sep 4, 2020

Workaround would be fine.
Otherwise i need to comment the call to gather stats in order to get coverage for the rest of the code.

@pesse
Copy link
Member

pesse commented Nov 12, 2020

@jgebal can you provide the workaround so it's documented and we can close the issue?

@rgerteis
Copy link

rgerteis commented Jun 9, 2021

Hi @geriweg, @pesse ,

has this issue ever been resolved? I'm running into the same error on Oracle 19.8 .

As our entire test suite run stops, the workaround: Ignore ... not sure if it would work.
How would I "ignore" the error?

I'm considering opening a bug-ticket with Oracle.

greetings
roman

@pesse
Copy link
Member

pesse commented Jun 10, 2021

Opening a bug-ticket with Oracle doesn't sound too bad.
@jgebal if you could provide the workaround you have, that would be awesome

@VladDr85
Copy link

VladDr85 commented Sep 2, 2021

@rgerteis
You have described the problem?
We received a response from Oracle?

@VladDr85
Copy link

VladDr85 commented Sep 2, 2021

@jgebal
Copy link
Member

jgebal commented Jan 30, 2022

The issue still occurs when running utPLSQL on code that calls dbms_stats package

@jgebal jgebal reopened this Jan 30, 2022
@lwasylow
Copy link
Member

Isn't it an Oracle bug? I guess worth keeping it for reference.

@lwasylow lwasylow added the bug label Jan 30, 2022
@jgebal
Copy link
Member

jgebal commented Feb 6, 2022

It is an Oracle bug, but we could do something about it to too.
We can silence the coverage_stop errors or report a warning (if possible) and then we would only report the coverage from dbms_proflier without data from dbms_plsql_code_coverage.

Oracle customers still need to report the problem to Oracle support and have the support look at it.

jgebal added a commit that referenced this issue Feb 6, 2022
Implemented a workaround that allows for running utPLSQL tests with code coverage on source with calls to DBMS_STATS.
Resolves: #1097
Resolves: #1094
@jgebal jgebal added this to the 3.1.12 milestone Feb 22, 2022
@jgebal jgebal self-assigned this Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants