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

[leo_gateway] A Delete request failed when cache.http_cache = true #482

Closed
mocchira opened this issue Jun 22, 2016 · 1 comment
Closed
Assignees
Milestone

Comments

@mocchira
Copy link
Member

mocchira commented Jun 22, 2016

Set cache.http_cache = true in leo_gateway.conf then
Invoking a delete request to leo_gateway will cause the below error

[E]     [email protected]     2016-06-22 02:01:12.512289 +0000        1466560872      leo_gateway_s3_api:handle_2/6   648     [{key,"bbb/hoge"},{cause,{function_clause,[{leo_gateway_http_commons,'-onresponse/2-fun-4-',[204,[{<<"connection">>,<<"keep-alive">>},{<<"date">>,<<"Wed, 22 Jun 2016 02:01:12 GMT">>},{<<"content-length">>,"0"},{<<"server">>,<<"LeoFS">>}],<<>>,{http_req,#Port<0.2100>,ranch_tcp,keepalive,<0.2234.0>,<<"DELETE">>,'HTTP/1.1',{{127,0,0,1},35347},<<"localhost">>,undefined,8080,<<"/bbb/hoge">>,undefined,<<>>,[],[],[{<<"user-agent">>,<<"curl/7.35.0">>},{<<"host">>,<<"localhost:8080">>},{<<"accept">>,<<"*/*">>}],[],undefined,[],waiting,<<>>,undefined,false,waiting,[],<<>>,already_called}],[{file,"src/leo_gateway_http_commons.erl"},{line,213}]},{cowboy_req,response,6,[{file,"src/cowboy_req.erl"},{line,1170}]},{cowboy_req,reply_no_compress,8,[{file,"src/cowboy_req.erl"},{line,930}]},{cowboy_req,reply,4,[{file,"src/cowboy_req.erl"},{line,885}]},{leo_gateway_s3_api,handle_2,6,[{file,"src/leo_gateway_s3_api.erl"},{line,645}]},{cowboy_handler,handler_handle,4,[{file,"src/cowboy_handler.erl"},{line,111}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,435}]}]}}]
[E]     [email protected]     2016-06-22 02:01:12.513300 +0000        1466560872      null:null       0       Error in process <0.2234.0> on node '[email protected]' with exit value: {function_clause,[{leo_gateway_http_commons,'-onresponse/2-fun-4-',[500,[{<<10 bytes>>,<<10 bytes>>},{<<6 bytes>>,<<6 bytes>>},{<<4 bytes>>,<<29 bytes>>},{<<14 bytes>>,"0"}],<<0 bytes>>,{http_req,#Port<0.2100>,ranch_tcp,keepalive,<0.2234.0>,<<6 bytes>>,'HTTP/1.1',{{127,0,0,1},35347},<<9 bytes>>,undefined,8080,<<9 bytes>>,undefined,<<0 bytes>>,undefined,[],[{<<10 bytes>>,<<11 bytes>>},{<<4 bytes>>,<<14 bytes>>},{<<6 bytes>>,<<3 bytes>>}],[],undefined,[],waiting,<<0 bytes>>,undefined... 


[E]     [email protected]     2016-06-22 02:01:12.515289 +0000        1466560872      null:null       0       Ranch listener leo_gateway_s3_api had connection process started with cowboy_protocol:start_link/4 at <0.2234.0> exit with reason: {function_clause,[{leo_gateway_http_commons,'-onresponse/2-fun-4-',[500,[{<<"connection">>,<<"keep-alive">>},{<<"server">>,<<"Cowboy">>},{<<"date">>,<<"Wed, 22 Jun 2016 02:01:12 GMT">>},{<<"content-length">>,"0"}],<<>>,{http_req,#Port<0.2100>,ranch_tcp,keepalive,<0.2234.0>,<<"DELETE">>,'HTTP/1.1',{{127,0,0,1},35347},<<"localhost">>,undefined,8080,<<"/bbb/hoge">>,undefined,<<>>,undefined,[],[{<<"user-agent">>,<<"curl/7.35.0">>},{<<"host">>,<<"localhost:8080">>},{<<"accept">>,<<"*/*">>}],[],undefined,[],waiting,<<>>,undefined,false,waiting,[],<<>>,already_called}],[{file,"src/leo_gateway_http_commons.erl"},{line,213}]},{cowboy_req,response,6,[{file,"src/cowboy_req.erl"},{line,1170}]},{cowboy_req,reply_no_compress,8,[{file,"src/cowboy_req.erl"},{line,930}]},{cowboy_req,reply,4,[{file,"src/cowboy_req.erl"},{line,885}]},{cowboy_req,maybe_reply,2,[{file,"src/cowboy_req.erl"},{line,995}]},{cowboy_handler,handler_handle,4,[{file,"src/cowboy_handler.erl"},{line,117}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,435}]}]}

due to the below pattern matching.
https://github.com/leo-project/leo_gateway/blob/1.2.22/src/leo_gateway_http_commons.erl#L213

Can be fixed by matching not only 200 but also other 20x status codes

@mocchira mocchira added this to the 1.2.23 milestone Jun 22, 2016
@mocchira mocchira self-assigned this Jun 22, 2016
@mocchira
Copy link
Member Author

It turned out that LeoFS also need to handle other status codes like 40x, 50x in onresponse handler.

@yosukehara yosukehara modified the milestones: 1.3.0, 1.2.23 Jun 23, 2016
@yosukehara yosukehara added v1.3 and removed v1.2 labels Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants