On Tue, Sep 10, 2013 at 7:50 PM, Paul Childs <pchi...@gmail.com> wrote:

> I went as far as to reboot my machine.
> I tried the view and it worked but then my other view started exhibiting
> the same error message.
>
>
Not sure if this helps, but I saw this once recently on a colleague's
windows machine. I'm going to see if we can reproduce it and try and add
more details, but I do remember it being hard to reproduce, so we let it
go. Sorry, not very helpful, but just wanted to let you know that it seems
like you may not be the only one who's run into this. Hopefully I'll be
able to reproduce the error with the colleague and get back - if it helps,
I'm fairly certain it is windows-specific, of course, I cannot be sure
(same project with same code runs without problem on my ubuntu machine).

Please do post if you find a solution, of course :-)

thanks,
Sanjay



> On Tuesday, September 10, 2013 11:01:42 AM UTC-3, Paul Childs wrote:
>>
>> Environment: Django 1.4, MySQL 5.5.33
>>
>> In one of my views I am consistently getting  a MySQL
>> error: OperationalError: (2006, 'MySQL server has gone away')
>>
>> Traceback (most recent call last):
>>   File "C:\Python26\Lib\wsgiref\**handlers.py", line 93, in run
>>     self.result = application(self.environ, self.start_response)
>>   File "C:\virtual_env\sitar_env2\**lib\site-packages\django\**
>> contrib\staticfiles\handlers.**py", line 67, in __call__
>>     return self.application(environ, start_response)
>>   File 
>> "C:\virtual_env\sitar_env2\**lib\site-packages\django\core\**handlers\wsgi.py",
>> line 241, in __call__
>>     response = self.get_response(request)
>>   File 
>> "C:\virtual_env\sitar_env2\**lib\site-packages\django\core\**handlers\base.py",
>> line 191, in get_response
>>     signals.got_request_exception.**send(sender=self.__class__,
>> request=request)
>>   File 
>> "C:\virtual_env\sitar_env2\**lib\site-packages\django\**dispatch\dispatcher.py",
>> line 172, in send
>>     response = receiver(signal=self, sender=sender, **named)
>>   File 
>> "C:\virtual_env\sitar_env2\**lib\site-packages\django\db\__**init__.py",
>> line 62, in _rollback_on_exception
>>     transaction.rollback_unless_**managed(using=conn)
>>   File 
>> "C:\virtual_env\sitar_env2\**lib\site-packages\django\db\**transaction.py",
>> line 129, in rollback_unless_managed
>>     connection.rollback_unless_**managed()
>>   File 
>> "C:\virtual_env\sitar_env2\**lib\site-packages\django\db\**backends\__init__.py",
>> line 214, in rollback_unless_managed
>>     self._rollback()
>>   File 
>> "C:\virtual_env\sitar_env2\**lib\site-packages\django\db\**backends\mysql\base.py",
>> line 404, in _rollback
>>     BaseDatabaseWrapper._rollback(**self)
>>   File 
>> "C:\virtual_env\sitar_env2\**lib\site-packages\django\db\**backends\__init__.py",
>> line 54, in _rollback
>>     return self.connection.rollback()
>> OperationalError: (2006, 'MySQL server has gone away')
>> [10/Sep/2013 10:29:11] "GET /trending/res_entry/pim/0/ HTTP/1.1" 500 59
>>
>> Looking at the stack trace it didn't look like the problem was with my
>> view.
>>
>> I traced through the code and the error occurs in one of the middleware
>> methods that is executed when I redirect to another page:
>>
>> > c:\virtual_env\sitar_env2\**cissimp\trending\views.py(67)**
>> res_management()
>> -> q_ress = Res.objects.filter(**maintenance_phase=maintenance_**phase)
>>   #### Hitting the DB OK here
>> (Pdb)
>> > c:\virtual_env\sitar_env2\**cissimp\trending\views.py(69)**
>> res_management()
>> -> res_list = fmas.get_ress(q_ress, mode, maintenance_phase)
>> (Pdb)
>> > c:\virtual_env\sitar_env2\**cissimp\trending\views.py(70)**
>> res_management()
>> -> request.session['my_res_list'] = res_list
>> (Pdb)
>> > c:\virtual_env\sitar_env2\**cissimp\trending\views.py(71)**
>> res_management()
>> -> return redirect('/trending/res_{0}/{**1}/1/'.format(mode,
>> (Pdb)
>> > c:\virtual_env\sitar_env2\**cissimp\trending\views.py(72)**
>> res_management()
>> -> maintenance_phase))
>> (Pdb)
>> --Return--
>> > c:\virtual_env\sitar_env2\**cissimp\trending\views.py(72)**
>> res_management()-><django....**04E53470>
>> -> maintenance_phase))
>> (Pdb)
>> > c:\virtual_env\sitar_env2\lib\**site-packages\django\core\**
>> handlers\base.py(124)get_**response()
>> -> if response is None:
>> (Pdb) response is None
>> False
>> (Pdb) n
>> > c:\virtual_env\sitar_env2\lib\**site-packages\django\core\**
>> handlers\base.py(133)get_**response()
>> -> if hasattr(response, 'render') and callable(response.render):
>> (Pdb) l
>> 128                             view_name = callback.__class__.__name__ +
>> '.__call__' # If it's a class
>> 129                         raise ValueError("The view %s.%s didn't
>> return an HttpResponse object." % (callback.__module__, view_name))
>> 130
>> 131                     # If the response supports deferred rendering,
>> apply template
>> 132                     # response middleware and the render the response
>> 133  ->                 if hasattr(response, 'render') and
>> callable(response.render):
>> 134                         for middleware_method in
>> self._template_response_**middleware:
>> 135                             response = middleware_method(request,
>> response)
>> 136                         response = response.render()
>> 137
>> 138                 except http.Http404, e:
>> (Pdb) n
>> > c:\virtual_env\sitar_env2\lib\**site-packages\django\core\**
>> handlers\base.py(183)get_**response()
>> -> urlresolvers.set_urlconf(None)
>> (Pdb) l
>> 178                     
>> signals.got_request_exception.**send(sender=self.__class__,
>> request=request)
>> 179                     response = self.handle_uncaught_**exception(request,
>> resolver, sys.exc_info())
>> 180             finally:
>> 181                 # Reset URLconf for this thread on the way out for
>> complete
>> 182                 # isolation of request.urlconf
>> 183  ->             urlresolvers.set_urlconf(None)
>> 184
>> 185             try:
>> 186                 # Apply response middleware, regardless of the
>> response
>> 187                 for middleware_method in self._response_middleware:
>> 188                     response = middleware_method(request, response)
>> (Pdb) n
>> > c:\virtual_env\sitar_env2\lib\**site-packages\django\core\**
>> handlers\base.py(185)get_**response()
>> -> try:
>> (Pdb) n
>> > c:\virtual_env\sitar_env2\lib\**site-packages\django\core\**
>> handlers\base.py(187)get_**response()
>> -> for middleware_method in self._response_middleware:
>> (Pdb) n
>> > c:\virtual_env\sitar_env2\lib\**site-packages\django\core\**
>> handlers\base.py(188)get_**response()
>> -> response = middleware_method(request, response)
>> (Pdb) n
>> > c:\virtual_env\sitar_env2\lib\**site-packages\django\core\**
>> handlers\base.py(187)get_**response()
>> -> for middleware_method in self._response_middleware:
>> (Pdb)
>> > c:\virtual_env\sitar_env2\lib\**site-packages\django\core\**
>> handlers\base.py(188)get_**response()
>> -> response = middleware_method(request, response)
>> (Pdb)
>> > c:\virtual_env\sitar_env2\lib\**site-packages\django\core\**
>> handlers\base.py(187)get_**response()
>> -> for middleware_method in self._response_middleware:
>> (Pdb)
>> > c:\virtual_env\sitar_env2\lib\**site-packages\django\core\**
>> handlers\base.py(188)get_**response()
>> -> *response = middleware_method(request, response)*
>> (Pdb)
>> *DatabaseError: Database...ne away'*)
>> > c:\virtual_env\sitar_env2\lib\**site-packages\django\core\**
>> handlers\base.py(188)get_**response()
>>
>> The interesting thing about this is that it only happens in the one view.
>>
>> I have tried to fix it by restarting MySQL but it didn't help. I checked
>> the error log and there was nothing in there to indicate a problem occurred.
>>
>> I'm at a loss as what to do next.
>>
>> If anyone can make a suggestion I'd love to hear it.
>>
>> Thanks,
>> /Paul
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to