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

Fix timeouts on plugin action returing the request #1297

Merged
merged 3 commits into from
May 14, 2019

Conversation

benoitvidis
Copy link
Contributor

What does this PR do ?

This PR fixes the case where Kuzzle would timeout without error when/if a plugin controller action returns a non-serializable response.
This is notably the case if a controller action returns the origin request.

@codecov
Copy link

codecov bot commented May 9, 2019

Codecov Report

Merging #1297 into 1-dev will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##            1-dev    #1297      +/-   ##
==========================================
+ Coverage   93.84%   93.84%   +<.01%     
==========================================
  Files          98       98              
  Lines        6852     6857       +5     
==========================================
+ Hits         6430     6435       +5     
  Misses        422      422
Impacted Files Coverage Δ
lib/api/controllers/funnelController.js 95.14% <100%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 03d3aab...aed1b46. Read the comment docs.

lib/api/controllers/funnelController.js Outdated Show resolved Hide resolved
if (!this.isNativeController(modifiedRequest) && !modifiedRequest.response.raw) {
// check if the plugin response can be serialized
try {
JSON.stringify(modifiedRequest.response.toJSON());
Copy link
Contributor

Choose a reason for hiding this comment

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

This check should be performed directly on responseData to prevent the unnecessary overhead of RequestResponse.toJSON.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@benoitvidis benoitvidis self-assigned this May 13, 2019
@Yoann-Abbes
Copy link
Contributor

The fact a routs plugin cannot send non-serialisable response anymore shoudnt be documented ?

@scottinet
Copy link
Contributor

@Yoann-Abbes > it is documented, and plugins can send non-serializable responses by setting the response.raw property to true. If you check the code again, you'll see that the check is not performed if that property is set.

@Aschen Aschen merged commit a032190 into 1-dev May 14, 2019
@Aschen Aschen deleted the KZL-1093-return-request-timeout branch May 14, 2019 16:08
@Aschen Aschen mentioned this pull request Jun 14, 2019
Aschen added a commit that referenced this pull request Jun 14, 2019
Release 1.8.0

Bug fixes

    [ #1311 ] Fix promise leaks (scottinet)
    [ #1298 ] Fix disabled protocol initialization (Aschen)
    [ #1297 ] Fix timeouts on plugin action returing the request (benoitvidis)
    [ #1288 ] Fix an error when trying a non-partial bulk update (scottinet)
    [ #1286 ] Allows bulk inserts on aliases (benoitvidis)
    [ #1282 ] Scan keys on redis cluster (benoitvidis)
    [ #1279 ] Users must be authenticated to use auth:logout (scottinet)

New features

    [ #1315 ] Add the new Vault module to handle encrypted application secrets (Aschen)
    [ #1302 ] Add write and mWrite (Aschen)
    [ #1305 ] Add pipes & hooks wildcard event (thomasarbona)

Enhancements

    [ #1318 ] Add a maximum ttl to auth:login (benoitvidis)
    [ #1301 ] Upgrade the WebSocket libraries (scottinet)
    [ #1308 ] Events triggering refactor (scottinet)
    [ #1300 ] Collection specifications methods cloisoned to a collection (thomasarbona)
    [ #1295 ] Improve validation error messages (benoitvidis)
    [ #1292 ] Throw an error when the realtime controller is invoked by plugin developers (benoitvidis)
    [ #1257 ] Add ability to define mapping policy for new fields (Aschen)
    [ #1291 ] Fix --help on subcommands (Yoann-Abbes)
    [ #1289 ] Handle ping/pong packets (scottinet)
    [ #1273 ] Fix incomplete access logs (scottinet)

Others

    [ #1317 ] Add ps dependency to plugin-dev Docker image for pm2 (benoitvidis)
    [ #1312 ] Check that .kuzzlerc.sample is well-formed (scottinet)
    [ #1299 ] Add Kuzzle Nightly & Redis 3 and 4 test (alexandrebouthinon)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants