Kinto / kinto

A generic JSON document store with sharing and synchronisation capabilities.
http://docs.kinto-storage.org/
Other
4.33k stars 422 forks source link

Kinto returns HTTP 500 on request with big 'cache_expires' #2667

Open AlexB1986 opened 3 years ago

AlexB1986 commented 3 years ago

Steps to reproduce docker run -p 8888:8888 kinto/kinto-server

First request

POST /v1/buckets HTTP/1.1
Host: 127.0.0.1:8888
Authorization: Basic YWRtaW46czNjcjN0
Content-Type: application/json
Content-Length: 222

{"data": {"collection:schema": {}, "group:schema": {}, "record:schema": {}}, "permissions": {"collection:create": ["write_account"], "group:create": ["write_account"], "read": ["read_account"], "write": ["write_account"]}}

First response

{
    "permissions": {
        "read": [
            "read_account"
        ],
        "write": [
            "account:admin",
            "write_account"
        ],
        "collection:create": [
            "write_account"
        ],
        "group:create": [
            "write_account"
        ]
    },
    "data": {
        "collection:schema": {},
        "group:schema": {},
        "record:schema": {},
        "id": "6wjNy_Vl",
        "last_modified": 1607584226615
    }
}

Second request

POST /v1/buckets/6wjNy_Vl/collections HTTP/1.1
Host: 127.0.0.1:8888
Authorization: Basic YWRtaW46czNjcjN0
Content-Type: application/json
Content-Length: 159

{"data": {"cache_expires": 1111111111111111111111, "schema": {}}, "permissions": {"read": ["read_account"], "record:create": null, "write": ["write_account"]}}

Second response -- 500 Internal Server Error

{
    "code": 500,
    "errno": 999,
    "error": "Internal Server Error",
    "message": "A programmatic error occured, developers have been informed.",
    "info": "https://github.com/Kinto/kinto/issues/"
}
Natim commented 3 years ago

Hello @AlexB1986 thanks you for your feedback.

Do you happen to have the server exception loge explaining the 500?

AlexB1986 commented 3 years ago
"POST /v1/buckets/PG-31Pu4/collections?" ? (? ms) int too big to convert errno=999
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pyramid/tweens.py", line 41, in excview_tween
response = handler(request)
File "/app/kinto/core/events.py", line 157, in tween
File "/usr/local/lib/python3.7/site-packages/pyramid/router.py", line 148, in handle_request
registry, request, context, context_iface, view_name
File "/usr/local/lib/python3.7/site-packages/pyramid/view.py", line 683, in _call_view
response = view_callable(context, request)
File "/usr/local/lib/python3.7/site-packages/pyramid/config/views.py", line 169, in __call__
return view(context, request)
File "/usr/local/lib/python3.7/site-packages/pyramid/config/views.py", line 188, in attr_view
File "/usr/local/lib/python3.7/site-packages/pyramid/config/views.py", line 214, in predicate_wrapper
File "/usr/local/lib/python3.7/site-packages/pyramid/viewderivers.py", line 325, in secured_view
File "/usr/local/lib/python3.7/site-packages/pyramid/viewderivers.py", line 436, in rendered_view
result = view(context, request)
File "/usr/local/lib/python3.7/site-packages/pyramid/viewderivers.py", line 144, in _requestonly_view
response = view(request)
File "/usr/local/lib/python3.7/site-packages/cornice/service.py", line 590, in wrapper
response = view_()
File "/app/kinto/core/resource/__init__.py", line 447, in plural_post
obj = self.model.create_object(new_object)
File "/app/kinto/core/resource/model.py", line 283, in create_object
modified_field=self.modified_field,
File "/app/kinto/core/decorators.py", line 70, in wrapper
return func(*args, **new_kwargs)
File "/app/kinto/core/decorators.py", line 45, in decorated
result = method(self, *args, **kwargs)
File "/app/kinto/core/storage/memory.py", line 186, in create
obj = json.loads(json.dumps(obj))
OverflowError: int too big to convert

"POST /v1/buckets/PG-31Pu4/collections?" 500 (5 ms) agent=PostmanRuntime/7.26.8 authn_type=account errno=999 time=2020-12-10T08:28:42.283000 uid=admin
MBhartiya commented 2 years ago

@AlexB1986 @leplatrem @Natim I tried recreating this bug, running via docker run -p 8888:8888 kinto/kinto-server with kinto/kinto-server:latest being higher than 14.3.0. I created an admin account and tried to reproduce, got 200. Seems like the issue is resolved.

Screenshot 2022-04-09 at 11 10 13 AM