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

Close socket immediately for fire and forget commands #1803

Merged
merged 1 commit into from
Jul 11, 2024

Conversation

tylerkaraszewski
Copy link
Contributor

@tylerkaraszewski tylerkaraszewski commented Jul 9, 2024

Details

It seems we don't close the sockets for fire and forget commands until after we finish the commands. Let's close them right after we send the response.

Fixed Issues

https://github.com/Expensify/Expensify/issues/411326

Tests

2024-07-10T22:36:43.812029+00:00 expensidev2004 php-fpm: HQsUhy /api.php [email protected] !web! ?api? [info] Set ASYNC NVP expensify_fixAccountDate
2024-07-10T22:36:43.814120+00:00 expensidev2004 php-fpm: HQsUhy /api.php [email protected] !web! ?api? [info] Bedrock\Client - Starting a request ~~ command: 'SetNameValuePair' clusterName: 'auth' headers: '[authToken: '<REDACTED>' name: 'expensify_fixAccountDate' value: '2024-07-10 22:36:43' Connection: 'forget' priority: '500' logParam: '[email protected]' urlToNewDot: 'https://dev.new.expensify.com:8082/' shouldReadUsingThreads: '1' shouldHandleOnyxUpdates: '1' clientUpdateID: '-1' maxNumberOfUpdates: '500' requestID: 'HQsUhy' lastIP: '10.2.2.1' writeConsistency: 'ASYNC' timeout: '110000']'
2024-07-10T22:36:43.814936+00:00 expensidev2004 bedrock: xxxxxx (BedrockServer.cpp:2074) _acceptSockets [main] [dbug] Accepting socket from '127.0.0.1:49016' on port '0.0.0.0:4444'
2024-07-10T22:36:43.815010+00:00 expensidev2004 php-fpm: HQsUhy /api.php [email protected] !web! ?api? [info] Closing socket after use
2024-07-10T22:36:43.823305+00:00 expensidev2004 php-fpm: HQsUhy /api.php [email protected] !web! ?api? [dbug] Auth - AuthRequest #2 command='Get' rVL='cardList'  
2024-07-10T22:36:43.823841+00:00 expensidev2004 php-fpm: HQsUhy /api.php [email protected] !web! ?api? [info] Bedrock\Client - Starting a request ~~ command: 'Get' clusterName: 'auth' headers: '[cardID: '' includeAllDeactivated: '1' authToken: '<REDACTED>' returnValueList: 'cardList' idempotent: '1' logParam: '[email protected]' urlToNewDot: 'https://dev.new.expensify.com:8082/' shouldReadUsingThreads: '1' shouldHandleOnyxUpdates: '1' clientUpdateID: '-1' maxNumberOfUpdates: '500' requestID: 'HQsUhy' lastIP: '10.2.2.1' writeConsistency: 'ASYNC' priority: '500' timeout: '110000']'
2024-07-10T22:36:43.823942+00:00 expensidev2004 php-fpm: HQsUhy /api.php [email protected] !web! ?api? [info] Bedrock\Client - APC fetch host configs ~~ 0: 'auth'
2024-07-10T22:36:43.824018+00:00 expensidev2004 php-fpm: HQsUhy /api.php [email protected] !web! ?api? [info] Bedrock\Client - Possible hosts ~~ nonBlacklistedHosts: '[0: 'auth']'
2024-07-10T22:36:43.824098+00:00 expensidev2004 php-fpm: HQsUhy /api.php [email protected] !web! ?api? [info] Bedrock\Client - Opening new socket ~~ host: 'auth' cluster: 'auth' pid: '1102'

Internal Testing Reminder: when changing bedrock, please compile auth against your new changes

@tylerkaraszewski tylerkaraszewski self-assigned this Jul 9, 2024
@tylerkaraszewski tylerkaraszewski requested a review from iwiznia July 9, 2024 17:10
Copy link
Contributor

@iwiznia iwiznia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Does this mean we don't need to change anything in the PHP side?
Can you please do a test in PHP of:

  • Send a command with fire&forget
  • Send another command without fire and forget
  • Check it opened a new socket

@tylerkaraszewski
Copy link
Contributor Author

Added test logs.

@iwiznia iwiznia merged commit 8f46054 into main Jul 11, 2024
1 check passed
@iwiznia iwiznia deleted the tyler-fix-fire-and-foreget branch July 11, 2024 08:40
@johnmlee101
Copy link
Contributor

reverting this since it created flakey tests here: https://expensify.slack.com/archives/C07J32337/p1720694871685509

@tylerkaraszewski
Copy link
Contributor Author

I will investigate next week.

@iwiznia
Copy link
Contributor

iwiznia commented Jul 12, 2024

hmmmm did not read that massive thread, but my guess is: before we were basically waiting for the fire&forget command to finish whenever we did another call to that bedrock instance, with this change we are not, so some tests expect some data to be set, but it is sometimes not because the fire&forget command runs/finishes after the test checks for it.

@johnmlee101
Copy link
Contributor

Yeah, that's basically the gist. We'll want to make sure our test suite is set beforehand, but the change itself should still be good

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.

3 participants