2 @message |
assert
ISQL process terminated.
- Memory differences median acceptable.
+ Memory LEAK detected. Median of differences: 1962.0 Kb - is UNACCEPTABLE. Check memo_rss_diff:
+ 1944
+ 1956
+ 1960
+ 1960
+ 1956
+ 1952
+ 1968
+ -640
+ 1972
+ 1972
+ 1968
+ 1968
+ 1964
+ 1972
LOG DETAILS:
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 act = <firebird.qa.plugin.Action object at [hex]>
2024-04-20 10:26:10.876 tmp_sql = WindowsPath('R:/temp/qa/fbqa/test_11550/tmp_8085.sql')
2024-04-20 10:26:10.876 tmp_log = WindowsPath('R:/temp/qa/fbqa/test_11550/tmp_8085.log')
2024-04-20 10:26:10.876 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 @pytest.mark.version('>=4.0.5')
2024-04-20 10:26:10.876 def test_1(act: Action, tmp_sql: Path, tmp_log: Path, capsys):
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 test_sql = f"""
2024-04-20 10:26:10.876 recreate table tmplog(srv_pid int);
2024-04-20 10:26:10.876 insert into tmplog(srv_pid)
2024-04-20 10:26:10.876 select mon$server_pid as p
2024-04-20 10:26:10.876 from mon$attachments
2024-04-20 10:26:10.876 where mon$attachment_id = current_connection
2024-04-20 10:26:10.876 ;
2024-04-20 10:26:10.876 commit;
2024-04-20 10:26:10.876 SET STATEMENT TIMEOUT 7200;
2024-04-20 10:26:10.876 set term ^;
2024-04-20 10:26:10.876 execute block as
2024-04-20 10:26:10.876 declare res double precision;
2024-04-20 10:26:10.876 begin
2024-04-20 10:26:10.876 while (1=1) do
2024-04-20 10:26:10.876 begin
2024-04-20 10:26:10.876 execute statement 'select ' || rand() || ' from rdb$database' into res;
2024-04-20 10:26:10.876 end
2024-04-20 10:26:10.876 end
2024-04-20 10:26:10.876 ^
2024-04-20 10:26:10.876 """
2024-04-20 10:26:10.876 with open(tmp_sql, 'w') as f:
2024-04-20 10:26:10.876 f.write(test_sql)
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 memo_rss_list = []
2024-04-20 10:26:10.876 with act.db.connect() as con:
2024-04-20 10:26:10.876 with open(tmp_log, 'w') as f:
2024-04-20 10:26:10.876 try:
2024-04-20 10:26:10.876 p_handed_isql = subprocess.Popen( [act.vars['isql'], '-i', str(tmp_sql),
2024-04-20 10:26:10.876 '-user', act.db.user,
2024-04-20 10:26:10.876 '-password', act.db.password, act.db.dsn],
2024-04-20 10:26:10.876 stdout = f,
2024-04-20 10:26:10.876 stderr = subprocess.STDOUT
2024-04-20 10:26:10.876 )
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 # Let ISQL time to establish connection and start infinite loop with ES:
2024-04-20 10:26:10.876 time.sleep(MAX_WAIT_FOR_ISQL_BEGIN_WORK)
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 cur = con.cursor()
2024-04-20 10:26:10.876 cur.execute('select srv_pid from tmplog')
2024-04-20 10:26:10.876 fb_srv = psutil.Process( int(cur.fetchone()[0]) )
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 for i in range(N_CNT):
2024-04-20 10:26:10.876 memo_rss_list.append(int(fb_srv.memory_info().rss / 1024))
2024-04-20 10:26:10.876 time.sleep(1)
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 finally:
2024-04-20 10:26:10.876 p_handed_isql.terminate()
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 p_handed_isql.wait(MAX_WAIT_FOR_ISQL_TERMINATE)
2024-04-20 10:26:10.876 if p_handed_isql.poll() is None:
2024-04-20 10:26:10.876 print(f'ISQL process WAS NOT terminated in {MAX_WAIT_FOR_ISQL_TERMINATE} second(s).!')
2024-04-20 10:26:10.876 else:
2024-04-20 10:26:10.876 print(f'ISQL process terminated.')
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 memo_rss_diff = []
2024-04-20 10:26:10.876 for i,x in enumerate(memo_rss_list):
2024-04-20 10:26:10.876 if i >= 1:
2024-04-20 10:26:10.876 memo_rss_diff.append(x - memo_rss_list[i-1])
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 memo_rss_diff_median = median(memo_rss_diff)
2024-04-20 10:26:10.876 median_acceptable_msg = 'Memory differences median acceptable.'
2024-04-20 10:26:10.876 if memo_rss_diff_median <= MAX_RSS_DIFFERENCE_MEDIAN:
2024-04-20 10:26:10.876 print(median_acceptable_msg)
2024-04-20 10:26:10.876 else:
2024-04-20 10:26:10.876 print(f'Memory LEAK detected. Median of differences: {memo_rss_diff_median} Kb - is UNACCEPTABLE. Check memo_rss_diff:')
2024-04-20 10:26:10.876 for p in memo_rss_diff:
2024-04-20 10:26:10.876 print('%6d' % p)
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 expected_stdout = f"""
2024-04-20 10:26:10.876 ISQL process terminated.
2024-04-20 10:26:10.876 {median_acceptable_msg}
2024-04-20 10:26:10.876 """
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 act.expected_stdout = expected_stdout
2024-04-20 10:26:10.876 act.stdout = capsys.readouterr().out
2024-04-20 10:26:10.876 > assert act.clean_stdout == act.clean_expected_stdout
2024-04-20 10:26:10.876 E assert
2024-04-20 10:26:10.876 E ISQL process terminated.
2024-04-20 10:26:10.876 E - Memory differences median acceptable.
2024-04-20 10:26:10.876 E + Memory LEAK detected. Median of differences: 1962.0 Kb - is UNACCEPTABLE. Check memo_rss_diff:
2024-04-20 10:26:10.876 E + 1944
2024-04-20 10:26:10.876 E + 1956
2024-04-20 10:26:10.876 E + 1960
2024-04-20 10:26:10.876 E + 1960
2024-04-20 10:26:10.876 E + 1956
2024-04-20 10:26:10.876 E + 1952
2024-04-20 10:26:10.876 E + 1968
2024-04-20 10:26:10.876 E + -640
2024-04-20 10:26:10.876 E + 1972
2024-04-20 10:26:10.876 E + 1972
2024-04-20 10:26:10.876 E + 1968
2024-04-20 10:26:10.876 E + 1968
2024-04-20 10:26:10.876 E + 1964
2024-04-20 10:26:10.876 E + 1972
2024-04-20 10:26:10.876
2024-04-20 10:26:10.876 tests\bugs\gh_8085_test.py:129: AssertionError
2024-04-20 10:26:10.876 ---------------------------- Captured stdout setup ----------------------------
2024-04-20 10:26:10.876 Cached db: db-13.0-None-None-NONE.fdb [page_size=None, sql_dialect=None, charset='NONE'
|
3 #text |
act = <firebird.qa.plugin.Action pytest object at [hex]>
tmp_sql = WindowsPath('R:/temp/qa/fbqa/test_11550/tmp_8085.sql')
tmp_log = WindowsPath('R:/temp/qa/fbqa/test_11550/tmp_8085.log')
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>
@pytest.mark.version('>=4.0.5')
def test_1(act: Action, tmp_sql: Path, tmp_log: Path, capsys):
test_sql = f"""
recreate table tmplog(srv_pid int);
insert into tmplog(srv_pid)
select mon$server_pid as p
from mon$attachments
where mon$attachment_id = current_connection
;
commit;
SET STATEMENT TIMEOUT 7200;
set term ^;
execute block as
declare res double precision;
begin
while (1=1) do
begin
execute statement 'select ' || rand() || ' from rdb$database' into res;
end
end
^
"""
with open(tmp_sql, 'w') as f:
f.write(test_sql)
memo_rss_list = []
with act.db.connect() as con:
with open(tmp_log, 'w') as f:
try:
p_handed_isql = subprocess.Popen( [act.vars['isql'], '-i', str(tmp_sql),
'-user', act.db.user,
'-password', act.db.password, act.db.dsn],
stdout = f,
stderr = subprocess.STDOUT
)
# Let ISQL time to establish connection and start infinite loop with ES:
time.sleep(MAX_WAIT_FOR_ISQL_BEGIN_WORK)
cur = con.cursor()
cur.execute('select srv_pid from tmplog')
fb_srv = psutil.Process( int(cur.fetchone()[0]) )
for i in range(N_CNT):
memo_rss_list.append(int(fb_srv.memory_info().rss / 1024))
time.sleep(1)
finally:
p_handed_isql.terminate()
p_handed_isql.wait(MAX_WAIT_FOR_ISQL_TERMINATE)
if p_handed_isql.poll() is None:
print(f'ISQL process WAS NOT terminated in {MAX_WAIT_FOR_ISQL_TERMINATE} second(s).!')
else:
print(f'ISQL process terminated.')
memo_rss_diff = []
for i,x in enumerate(memo_rss_list):
if i >= 1:
memo_rss_diff.append(x - memo_rss_list[i-1])
memo_rss_diff_median = median(memo_rss_diff)
median_acceptable_msg = 'Memory differences median acceptable.'
if memo_rss_diff_median <= MAX_RSS_DIFFERENCE_MEDIAN:
print(median_acceptable_msg)
else:
print(f'Memory LEAK detected. Median of differences: {memo_rss_diff_median} Kb - is UNACCEPTABLE. Check memo_rss_diff:')
for p in memo_rss_diff:
print('%6d' % p)
expected_stdout = f"""
ISQL process terminated.
{median_acceptable_msg}
"""
act.expected_stdout = expected_stdout
act.stdout = capsys.readouterr().out
> assert act.clean_stdout == act.clean_expected_stdout
E assert
E ISQL process terminated.
E - Memory differences median acceptable.
E + Memory LEAK detected. Median of differences: 1962.0 Kb - is UNACCEPTABLE. Check memo_rss_diff:
E + 1944
E + 1956
E + 1960
E + 1960
E + 1956
E + 1952
E + 1968
E + -640
E + 1972
E + 1972
E + 1968
E + 1968
E + 1964
E + 1972
tests\bugs\gh_8085_test.py:129: AssertionError
|