Skip to content
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

Error while calling public.powa_wait_sampling_src: invalid memory alloc request size 1173399096 #74

Closed
tarkhil opened this issue Oct 16, 2024 · 10 comments
Labels

Comments

@tarkhil
Copy link

tarkhil commented Oct 16, 2024

master: Error while calling public.powa_wait_sampling_src: invalid memory alloc request size 1173399096 
CONTEXT: SQL statement 
"SELECT now(), COALESCE(pgss.dbid, 0) AS dbid, s.event_type, s.event, s.queryid, sum(s.count) as count FROM pg_wait_sampling_profile s 
-- pg_wait_sampling doesn't offer a per (userid, dbid, queryid) view, 
-- only per pid, but pid can be reused for different databases or users 
-- so we cannot deduce db or user from it. However, queryid should be 
-- unique across differet databases, so we retrieve the dbid this way. 
-- Note that the same queryid can exists for multiple entries if 
-- multiple users execute the query, so it's critical to retrieve a 
-- single row from pg_stat_statements per (dbid, queryid) 
LEFT JOIN (SELECT DISTINCT s2.dbid, s2.queryid FROM pg_stat_statements(false) s2 ) pgss 
ON pgss.queryid = s.queryid 
WHERE s.event_type IS NOT NULL AND s.event IS NOT NULL AND COALESCE(pgss.dbid, 0) NOT IN (
SELECT oid FROM powa_databases WHERE dropped IS NOT NULL) GROUP BY pgss.dbid, s.event_type, s.event, s.queryid" PL/pgSQL function powa_wait_sampling_src(integer) line 4 at RETURN QUERY

No idea on the reason.

@marco44
Copy link
Contributor

marco44 commented Oct 16, 2024

Looks like this query wants to retrieve 1GB of data. Did you set pg_wait_sampling.profile_pid to off? If not the produced view can be quite huge (and return data we don't care about in powa)

@rjuju rjuju added the question label Oct 16, 2024
@tarkhil
Copy link
Author

tarkhil commented Oct 17, 2024

Okay, did it; should I cleanup something to get rid of the error?

@marco44
Copy link
Contributor

marco44 commented Oct 17, 2024

I suppose calling pg_wait_sampling_reset_profile() should be enough

@tarkhil
Copy link
Author

tarkhil commented Oct 17, 2024

Yes, it works!

@tarkhil tarkhil closed this as completed Oct 17, 2024
@tarkhil tarkhil reopened this Oct 17, 2024
@tarkhil
Copy link
Author

tarkhil commented Oct 17, 2024

No error, no data. Should something be restarted/reconfigured?

@rjuju
Copy link
Member

rjuju commented Oct 17, 2024

It shouldn't be needed.

Do you see any row in the powa_wait_sampling_history_current table of the powa repository server? If not, do you see rows in the powa_wait_sampling_src_tmp table on the same repository server?

@tarkhil
Copy link
Author

tarkhil commented Oct 17, 2024

powa=# select count(*) from powa_wait_sampling_history_current ;
 count
-------
 21745
(1 row)

and still nothing in web interface

@rjuju
Copy link
Member

rjuju commented Oct 17, 2024

Looking at the code I don't see any reason why it wouldn't be displayed. Is it the same on all pages (per instance, per database, per query)?

Are you using the remote mode or local mode? If remote, how many remote servers do you have? Is the configuration page shows that pg_wait sampling is sampled and find the correct version? (assuming the UI is available on 127.0.0.1:8888 and the server has the id 42, url http://127.0.0.1:8888/config/42)

@tarkhil
Copy link
Author

tarkhil commented Oct 17, 2024

Right after your comment, everything reappeared.

(actually, I went from the Home button and now it works)

@tarkhil tarkhil closed this as completed Oct 17, 2024
@rjuju
Copy link
Member

rjuju commented Oct 17, 2024

Ah, good news. Maybe it's due to a somewhat large snapshot interval. In general data only appear after 3 snapshots, since we compute diff between snapshot (so 2 values to get a single counter), and then needs a 3rd snapshot to start drawing lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants