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

test interleaved reading of result streams #972

Closed

Conversation

rich-murphey
Copy link
Contributor

This tests tries to induce interleaved reading of result streams.

The test:
creates a pool of 90 connections. (postgres default max is 100).
spawns 180 threads that read a table of 100 rows.
in each thread:
collect a stream of results to an array.
for each item in the stream, wait one millisecond (the tokio sleep granularity).

The wait should induce interleaved reading of result streams.

The intent here was to try to reproduce postgres null MessageFormat errors; however, the test shows no such errors.

@rich-murphey
Copy link
Contributor Author

To run this test, use:

cargo test --release --features postgres,runtime-actix-rustls -- --ignored --nocapture pool_interleave_test

Note that --release and a multi threaded runtime are required to reproduce #886 in other tests.

@rich-murphey
Copy link
Contributor Author

This is a re-write of the test for the error:

Error: encountered unexpected or invalid data: unknown message type: '\u{0}'

this occurs (for me) only when a specific non-default connection option is set:

.test_before_acquire(false)

I've renamed the test to: drop_query_test

run it using:

cargo test --release --features postgres,runtime-actix-rustls -- --ignored --nocapture drop_query_test

@rich-murphey
Copy link
Contributor Author

Correction, to run it you also need the 'json' feature:

cargo test --release --features postgres,runtime-actix-rustls,json -- --ignored --nocapture drop_query_test

@mehcode mehcode marked this pull request as draft January 21, 2021 06:12
@mehcode
Copy link
Member

mehcode commented Jan 21, 2021

love the test work here @rich-murphey

marking as draft though as we don't want to merge this as-is. we'll want to cherry-pick these tests into next when ready

@rich-murphey
Copy link
Contributor Author

I'm also OK with closing this and re-submittng for the branch 'next' when the time is right.

@mehcode
Copy link
Member

mehcode commented Feb 1, 2021

Agreed. Great work so far but we should get this on next soon (tm).


this occurs (for me) only when a specific non-default connection option is set:

It's hard to trigger the source problem in Postgres. This is because Postgres has a mostly sane and stateless protocol. The future has to be dropped at just the right time.

@mehcode mehcode closed this Feb 1, 2021
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 this pull request may close these issues.

2 participants