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

FATAL: sorry, too many clients already #124

Closed
visch opened this issue Apr 12, 2023 · 6 comments · Fixed by #220
Closed

FATAL: sorry, too many clients already #124

visch opened this issue Apr 12, 2023 · 6 comments · Fixed by #220

Comments

@visch
Copy link
Member

visch commented Apr 12, 2023

Recieved a bunch of messages for one stream Schema has changed for stream 'campaign_performance_stats'. Mapping definitions will be reset.

The schema messages here were the same so it's not clear why this was happening.

The tap here shouldn't be sending so many schema messages but the target shouldn't say the schema has changed when it hasn't I believe.

Example messages that cause this

{"type": "SCHEMA", "stream": "campaign_performance_stats", "schema": {"properties": {"Name": {"type": ["string", "null"]}, "Id": {"type": ["string", "null"]}, "Date": {"format": "date", "type": ["string", "null"]}, "Clicks": {"type": ["integer", "null"]}, "Impressions": {"type": ["integer", "null"]}, "Conversions": {"type": ["integer", "null"]}, "CurrencyCode": {"type": ["string", "null"]}, "Cost": {"type": ["number", "null"]}, "OrganicClicks": {"type": ["integer", "null"]}, "OrganicImpressions": {"type": ["integer", "null"]}, "Applystarts": {"type": ["integer", "null"]}, "OrganicApplystarts": {"type": ["integer", "null"]}, "_sdc_employer_id": {"type": ["string", "null"]}, "_sdc_campaign_id": {"type": ["string", "null"]}}, "type": "object"}, "key_properties": ["Id", "Date"], "bookmark_properties": ["Date"]}
{"type": "SCHEMA", "stream": "campaign_performance_stats", "schema": {"properties": {"Name": {"type": ["string", "null"]}, "Id": {"type": ["string", "null"]}, "Date": {"format": "date", "type": ["string", "null"]}, "Clicks": {"type": ["integer", "null"]}, "Impressions": {"type": ["integer", "null"]}, "Conversions": {"type": ["integer", "null"]}, "CurrencyCode": {"type": ["string", "null"]}, "Cost": {"type": ["number", "null"]}, "OrganicClicks": {"type": ["integer", "null"]}, "OrganicImpressions": {"type": ["integer", "null"]}, "Applystarts": {"type": ["integer", "null"]}, "OrganicApplystarts": {"type": ["integer", "null"]}, "_sdc_employer_id": {"type": ["string", "null"]}, "_sdc_campaign_id": {"type": ["string", "null"]}}, "type": "object"}, "key_properties": ["Id", "Date"], "bookmark_properties": ["Date"]}
{"type": "SCHEMA", "stream": "campaign_performance_stats", "schema": {"properties": {"Name": {"type": ["string", "null"]}, "Id": {"type": ["string", "null"]}, "Date": {"format": "date", "type": ["string", "null"]}, "Clicks": {"type": ["integer", "null"]}, "Impressions": {"type": ["integer", "null"]}, "Conversions": {"type": ["integer", "null"]}, "CurrencyCode": {"type": ["string", "null"]}, "Cost": {"type": ["number", "null"]}, "OrganicClicks": {"type": ["integer", "null"]}, "OrganicImpressions": {"type": ["integer", "null"]}, "Applystarts": {"type": ["integer", "null"]}, "OrganicApplystarts": {"type": ["integer", "null"]}, "_sdc_employer_id": {"type": ["string", "null"]}, "_sdc_campaign_id": {"type": ["string", "null"]}}, "type": "object"}, "key_properties": ["Id", "Date"], "bookmark_properties": ["Date"]}
@visch
Copy link
Member Author

visch commented Apr 12, 2023

Verified that this opens up 100 connections in my use case. This seems like multiple issues.

  1. Pooling doesn't seem to be working properly / setup properly
  2. Schema messages that are the same shouldn't trigger a "schema has changed" message

@visch
Copy link
Member Author

visch commented Jun 15, 2023

Related to #140 and #103

@visch
Copy link
Member Author

visch commented Jul 14, 2023

I thought we solved it in #153 but I just hit this running a seperate job in a production setting. Going to dive in

Found that the original cause for this issue (the schema messages in the order sent) no longer cause this. Not sure what causes my setup to fail with this yet.

Number of connections just goes up, it looks like connections are not torn down right now properly or atleast not reused as expected

@visch
Copy link
Member Author

visch commented Jul 14, 2023

I seem to hit this in 2 occasions

  1. Sending a lot of SCHEMA messages on existing sinks
  2. Running pytest (Call select count(*) from pg_stat_activity; as the tests are running and you'll get up to 40-80 connections) . This may be due to new Targets being initialized for every test.

@BuzzCutNorman
Copy link
Contributor

If you would please give this sdk pr a try, meltano/sdk#1864, and see if it reduces the connection count during a run.

visch pushed a commit that referenced this issue Nov 27, 2023
~~SDK bump~~
Pytest for multiple identical schema messages don't log "schema changed"

This doesn't directly address the problems in #124 because they have
already been solved elsewhere. It merely ensures the tap uses an SDK
version with the fix, and also adds a test to check that the behavior
described in #124 won't happen again.

Closes #124
@amotl
Copy link
Contributor

amotl commented Dec 19, 2023

Hi @visch, @BuzzCutNorman, and @edgarrmondragon,

it looks like this one is tripping again. I am observing it on my workstation, and on CI, like at GH-250. Do you think that would qualify to re-open this ticket?

@visch said:

Verified that this opens up 100 connections in my use case. This seems like multiple issues.

  1. Pooling doesn't seem to be working properly / setup properly

That would also be my personal feeling about the situation. However, I haven't been able to take a closer look up until now, and thought it would be a good idea to talk to you beforehand.

With kind regards,
Andreas.

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

Successfully merging a pull request may close this issue.

3 participants