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

Server crashes if text field is too long #60

Open
ssfrr opened this issue May 19, 2015 · 0 comments
Open

Server crashes if text field is too long #60

ssfrr opened this issue May 19, 2015 · 0 comments

Comments

@ssfrr
Copy link
Member

ssfrr commented May 19, 2015

Specifically this is a sensor with a unit name that's more than 30 characters, but I'm guessing the issue is in other DB inserts as well.

Traceback (most recent call last):

  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 114, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 57, in wrapped_view
    return view_func(*args, **kwargs)

  File "/home/sfr/chain-api/chain/core/api.py", line 748, in create_view
    return cls.create_single(data, request)

  File "/home/sfr/chain-api/chain/core/resources.py", line 630, in create_single
    return ScalarSensorResource.create_single(data, req)

  File "/home/sfr/chain-api/chain/core/api.py", line 755, in create_single
    new_resource.save()

  File "/home/sfr/chain-api/chain/core/api.py", line 544, in save
    self.deserialize()

  File "/home/sfr/chain-api/chain/core/api.py", line 500, in deserialize
    new_obj_data, stub_field_name, self._data[stub_field_name])

  File "/home/sfr/chain-api/chain/core/api.py", line 448, in stub_object_finding
    matching_related_obj.save()

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 545, in save
    force_update=force_update, update_fields=update_fields)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 573, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 654, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 687, in _do_insert
    using=using, raw=raw)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 232, in _insert
    return insert_query(self.model, objs, fields, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1511, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)

  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 899, in execute_sql
    cursor.execute(sql, params)

  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)

  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)

  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)

DataError: value too long for type character varying(30)



<WSGIRequest
path:/sensors/create,
GET:<QueryDict: {u'device_id': [u'22323']}>,
POST:<QueryDict: {}>,
COOKIES:{},
META:{'CONTENT_LENGTH': '82',
 u'CSRF_COOKIE': u'wxGbCbZIie997Edr4CdwYCaXTIHmyZqw',
 'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_AUTHORIZATION': 'Basic Y2hhaW5jb2xsZWN0b3JzOlY4VGlPRTZ5VndwaklpbTEzeWJoakE5Tw==',
 'HTTP_CONNECTION': 'close',
 'HTTP_HOST': 'chain-api.media.mit.edu',
 'HTTP_USER_AGENT': 'python-requests/2.3.0 CPython/2.7.3 Linux/3.11.0-26-generic',
 'HTTP_X_FORWARDED_FOR': '18.85.58.252',
 'PATH_INFO': u'/sensors/create',
 'QUERY_STRING': 'device_id=22323',
 'RAW_URI': '/sensors/create?device_id=22323',
 'REMOTE_ADDR': '18.85.58.252',
 'REMOTE_PORT': '80',
 'REQUEST_METHOD': 'POST',
 'SCRIPT_NAME': u'',
 'SERVER_NAME': 'chain-api.media.mit.edu',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.0',
 'SERVER_SOFTWARE': 'gunicorn/18.0',
 'gunicorn.socket': <socket._socketobject object at 0x2c07a60>,
 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7fd794eae270>,
 'wsgi.file_wrapper': <class gunicorn.http.wsgi.FileWrapper at 0x1962668>,
 'wsgi.input': <gunicorn.http.body.Body object at 0x2b2f390>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>
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

No branches or pull requests

1 participant