#29989: Geodjango running through memory
-------------------------------------+-------------------------------------
     Reporter:  Taylor               |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  GIS                  |                  Version:  2.1
     Severity:  Normal               |               Resolution:
     Keywords:  raster, geodjango,   |             Triage Stage:
  postgis                            |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Taylor:

Old description:

> I have been trying to upload a raser to my postgis backend and keep
> running into
>   {{{#!python
> django.db.utils.OperationalError: cannot allocate memory for output
> buffer
>   }}}
> I try to upload the file in the django shell using the following:
>
>   {{{#!python
> raster = GDALRaster('rasters/data/my_image.tif', write=True)
> r = RastModel(name="Foo", image=raster)
> r.save()
>   }}}
> The image is only about a gb and I have plenty of ram to handle it. When
> I save the raster it runs through almost all 32gb of ram and then throws
> the error. From all the docs and posts I have seen it appears that I am
> uploading the raster correctly so I am assuming there is a bug somewhere.

New description:

 I have been trying to upload a raser to my postgis backend and keep
 running into
   {{{#!python
 django.db.utils.OperationalError: cannot allocate memory for output buffer
   }}}
 I try to upload the file in the django shell using the following:

   {{{#!python
 raster = GDALRaster('rasters/data/my_image.tif', write=True)
 r = RastModel(name="Foo", image=raster)
 r.save()
   }}}

 The image is only about a gb and I have plenty of ram to handle it. When I
 save the raster it runs through almost all 32gb of ram and then throws the
 error. From all the docs and posts I have seen it appears that I am
 uploading the raster correctly so I am assuming there is a bug somewhere.

 {{{

 >>> rast = GDALRaster('rasters/data/raw_tempe.tif', write=True)
 >>> r = Rast(name='Test', image=rast)
 >>> r.save()
 Traceback (most recent call last):
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/backends/utils.py", line 85, in _execute
     return self.cursor.execute(sql, params)
 psycopg2.OperationalError: cannot allocate memory for output buffer


 The above exception was the direct cause of the following exception:

 Traceback (most recent call last):
   File "<console>", line 1, in <module>
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/models/base.py", line 718, in save
     force_update=force_update, update_fields=update_fields)
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/models/base.py", line 748, in save_base
     updated = self._save_table(raw, cls, force_insert, force_update,
 using, update_fields)
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/models/base.py", line 831, in _save_table
     result = self._do_insert(cls._base_manager, using, fields, update_pk,
 raw)
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/models/base.py", line 869, in _do_insert
     using=using, raw=raw)
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/models/manager.py", line 82, in manager_method
     return getattr(self.get_queryset(), name)(*args, **kwargs)
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/models/query.py", line 1136, in _insert
     return query.get_compiler(using=using).execute_sql(return_id)
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/models/sql/compiler.py", line 1289, in execute_sql
     cursor.execute(sql, params)
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/backends/utils.py", line 100, in execute
     return super().execute(sql, params)
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/backends/utils.py", line 68, in execute
     return self._execute_with_wrappers(sql, params, many=False,
 executor=self._execute)
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
     return executor(sql, params, many, context)
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/backends/utils.py", line 85, in _execute
     return self.cursor.execute(sql, params)
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/utils.py", line 89, in __exit__
     raise dj_exc_value.with_traceback(traceback) from exc_value
   File "/mnt/f/Projects/gis322/env/lib/python3.6/site-
 packages/django/db/backends/utils.py", line 85, in _execute
     return self.cursor.execute(sql, params)
 django.db.utils.OperationalError: cannot allocate memory for output buffer

 }}}

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29989#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.43e0f8095cd14466d30aeb86d1a0d39b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to