Repository navigation
Closed
Description
The coverage report doesn't run or takes forever.
version: 18.0.0.0.0
compatibility: 18.0.0
ut_version: v3.1.3.2402
Edition: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0
Port String: x86_64/Linux 2.4.xx
Information about client software
SQLDeveloper, SQLPlus, utPLSQL-cli
To Reproduce
./utplsql run ***/***@host:1521/*** -f=ut_coverage_html_reporter -o=coverage.html
Expected behavior
A HTML file with the coverage report
Details of the issue
A couple of "utPLSQL" and "JDBC Thin Client" database sessions get stuck waiting forever for the following wait-events:
- resmgr:cpu quantum
- PL/SQL lock timer
- PX Deq: Execute Reply
The SQL running queries are:
select full_name
, owner
, name
, line
, to_be_skipped
, text
from (
select lower(s.owner || '.' || s.name) as full_name
, s.owner
, s.name
, s.line - coalesce(
case
when type != 'TRIGGER' then
0
end
,(
select min(t.line) - 1
from dba_source t
where t.owner = s.owner
and t.type = s.type
and t.name = s.name
and regexp_like(t.text, '[A-Za-z0-9$#_]*(begin|declare|compound).*', 'i')
)) as line
, s.text
, case
when
-- to avoid execution of regexp_like on every line
-- first do a rough check for existence of search pattern keyword
( lower(s.text) like '%procedure%'
or lower(s.text) like '%function%'
or lower(s.text) like '%begin%'
or lower(s.text) like '%end%'
or lower(s.text) like '%package%' )
and regexp_like ( s.text
, '^([\t ]*(((not)?\s*(overriding|final|instantiable)[\t ]*)*(static|constructor|member)?[\t ]*(procedure|function)|package([\t ]+body)|begin|end([\t ]+\S+)*[ \t]*;))'
, 'i' ) then
'Y'
end as to_be_skipped
from dba_source s
where s.owner in (
select upper(t.column_value)
from table ( :l_schema_names ) t
)
and s.type not in (
'PACKAGE'
, 'TYPE'
, 'JAVA SOURCE'
)
--Exclude calls to utPLSQL framework, Unit Test packages and objects from a_exclude_list parameter of coverage reporter
and ( s.owner
, s.name ) not in (
select el.owner
, el.name
from table ( :l_skipped_objects ) el
)
)
where line > 0
and
select column_value as text
from table ( ( :b1 ).get_lines ( :b2
, :b3 ) )
Running the tests works fine. Only the Coverage Report doesn't run.
Activity
lwasylow commentedon Jul 7, 2019
Hi did you try 3.1.7? There were improvements in terms of overall performance.
rafael-trevisan commentedon Jul 7, 2019
Hey, I'll try it.
jgebal commentedon Jul 7, 2019
What schema are you running coverage on?
How many code objects (packages /triggers/procedures etc) do you have in that schema?
If the query is stuck I suspect it's due to huge schema or lack of up to date fixed table statistics.
rafael-trevisan commentedon Jul 8, 2019
I'm running on the application schema.
Not many packages/triggers. About 30 packages and 60 triggers. Shouldn't take this long. I remember running the same "Coverage Report" not so long ago and it was fine. The only big change I can recall was changing the Oracle from non-pdb to pdb. Other than that is the same. I will get utPLSQL upgraded in the server this week and will try again.
Table stats seem to be fine too.
rafael-trevisan commentedon Jul 8, 2019
Hi guys, I upgraded utPLSQL to 3.1.7 but it didn't fix the issue.
Whenever I run a Coverage Report it gets stuck.
The findings I have so far are:
I will be troubleshooting this today. If someone has any idea or suggestion they'd be very appreciated :)
rafael-trevisan commentedon Jul 8, 2019
Another finding here:
The DBA also pointed another related session under the module "JDBC Thin Client". He said this session was waiting due to a
dbms_session.lockDon't know if that helps somehow
pesse commentedon Jul 8, 2019
Hey @rafael-trevisan , which version of utplsql-cli are you using?
You can find out by doing
./utplsql infoIt would also be great if you did a run with
-dparameter and send me the output:./utplsql run ***/***@host:1521/*** -f=ut_coverage_html_reporter -o=coverage.htmlrafael-trevisan commentedon Jul 8, 2019
Here you go
rafael-trevisan commentedon Jul 8, 2019
The session gets stuck waiting for PX and this is the explain plan:
rafael-trevisan commentedon Jul 8, 2019
Another thing here.
If I run within SQLDev the Coverage Report for a single package, it works:
However, if I remove the filter for the objects, it gets stuck again with the same wait event in the same query.
rafael-trevisan commentedon Jul 9, 2019
Hi guys,
Some update on this.
The DBA did some investigation, and after commenting out (for only testing purpose) the line 60 of
ut3.ut_coveragewe got the Coverage Report working here.The line we commented out is:
If we put this line back, the session gets stuck again and never finishes.
Would this be safe to use as a workaround or could that bring potentially problem that we aren't aware?
lwasylow commentedon Jul 9, 2019
I believe it will report incorrectly on lines for triggers. Would be interesting to see what executions plans are selected.
rafael-trevisan commentedon Jul 9, 2019
I will try to get the execution plan here.
Would there be a way to run the Coverage Report only for packages then? I mean, I know there are parameters to filter including/excluding object names, but am not sure about object types.
lwasylow commentedon Jul 9, 2019
I don't think so but that's probably a good enhancements idea.
Do you have an source code of packages in file? If so you can try to use a a_source_file_mappings and if you point on folder with source code that have only packages than it will limit. But that's very depend on how your db project is setup. Maybe @jgebal got some idea?
rafael-trevisan commentedon Jul 9, 2019
I do have all my source code in files. I tried to use this mapping parameter once but I didn't get much lucky.
My current folder structure is:
How would be the
a_source_file_mappingswith this structure?10 remaining items
tetardv commentedon Jul 12, 2019
hello,
for me disabling parallel query and dml remove the timeout, so now my coverage has been running for more than 6hours now. The database im running into is docker image created from Oracle repo itself, I can make any change I want to since I am administering it even if I am not the dba of my company. But what parameters should I change ?
regards,
vincent
PhilippSalvisberg commentedon Jul 12, 2019
@rafael-trevisan first of all we have to find the root cause. So, the questions remains. How long did the anonymous PL/SQL block ran in your environment (with disable parallel query and parallel dml)?
rafael-trevisan commentedon Jul 12, 2019
PhilippSalvisberg commentedon Jul 12, 2019
@rafael-trevisan and what is the runtime without parallel query/dml? Without this information we do not know if this is a viable workaround.
rafael-trevisan commentedon Jul 12, 2019
I'll uncomment the line
and regexp_like( t.text, '[A-Za-z0-9$#_]*(begin|declare|compound).*','i')and will test it. Will share the results here.PhilippSalvisberg commentedon Jul 12, 2019
@tetardv I suggest to run
before trying to run the coverage report again.
PhilippSalvisberg commentedon Jul 12, 2019
But we already know that commenting out this line helps and that it produces a false result. So, I suggest to test it without changing the utPLSQL code. Thanks.
rafael-trevisan commentedon Jul 14, 2019
Hi all, disabling the parallel in the session didn't resolve the issue. It changed indeed the wait event from PX deq something to db file sequential read, but it never finished running the report.
After continuing the investigation it became clear that
and regexp_like(...was making the inner query to be very very slow. When we changed the line 60 to be a set ofor t.text like '%begin%'(pseudo-code just as example), it ran beautifully.Interestingly, line 66 seems to have thought about this issue 🤔
Anyways, in the end the DBA changed a bit the query to keep the
regex_likebut he used thewithcommand to query thedba_sourcejust once and then pointed the outer and inner query to use this "with dataset". This workaround also worked beautifully (even faster than havingor like or like or like) and it's the one we decided to keep.We will post here the code he changed, but I hope this comment helps to understand and explain the issue.
jgebal commentedon Jul 14, 2019
Thanks @rafael-trevisan
I will include that fix (once you publish it).
I also have another improvement for coverage query waiting to be published.
You can see it here
The idea is to separate the more complex query (on Triggers) from the one that is more straightforward.
If your schema doesn't contain triggers, you should see it running a bit faster too.
tetardv commentedon Jul 16, 2019
hello,
Removing the line 'and regexp_like( t.text, '[A-Za-z0-9$#_](begin|declare|compound).','i')' worked for me as well. And @PhilippSalvisberg only created the html file with no input, it find no objects at all.
looking forward to have this issue fix then. Thank you guys.
Regards,
vincent.
jgebal commentedon Jul 16, 2019
@rafael-trevisan
Can you provide the modified query text?
fabiopan commentedon Jul 17, 2019
Below is the change we have made.
#980