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

[8.0] Exception during JSON request handling http.py #5313

Closed
missilefish opened this issue Feb 16, 2015 · 8 comments
Closed

[8.0] Exception during JSON request handling http.py #5313

missilefish opened this issue Feb 16, 2015 · 8 comments

Comments

@missilefish
Copy link

This seems to be calendar related, I do have google syncd.

2015-02-16 18:56:36,238 8715 ERROR *****(redacted) openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
  File "/opt/odoo/odoo-server/openerp/http.py", line 530, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/odoo-server/openerp/http.py", line 567, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/odoo-server/openerp/http.py", line 303, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/odoo-server/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo-server/openerp/http.py", line 300, in checked_call
    return self.endpoint(*a, **kw)
  File "/opt/odoo/odoo-server/openerp/http.py", line 796, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/odoo-server/openerp/http.py", line 396, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/odoo-server/addons/calendar/controllers/main.py", line 61, in notify
    res = registry.get("calendar.alarm_manager").get_next_notif(cr, uid, context=context)
  File "/opt/odoo/odoo-server/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/odoo-server/addons/calendar/calendar.py", line 495, in get_next_notif
    for one_date in self.pool.get("calendar.event").get_recurrent_date_by_event(cr, uid, curEvent, context=context):
  File "/opt/odoo/odoo-server/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/odoo/odoo-server/addons/calendar/calendar.py", line 711, in get_recurrent_date_by_event
    rset1 = rrule.rrulestr(str(event.rrule), dtstart=startdate, forceset=True)
  File "/usr/lib/python2.7/dist-packages/dateutil/rrule.py", line 1093, in __call__
    return self._parse_rfc(s, **kwargs)
  File "/usr/lib/python2.7/dist-packages/dateutil/rrule.py", line 994, in _parse_rfc
    raise ValueError, "empty string"
ValueError: empty string
2015-02-16 18:56:36,239 8715 INFO jafactory werkzeug: 68.231.67.174 - - [16/Feb/2015 18:56:36] "POST /calendar/notify HTTP/1.1" 200 -
@malatestay
Copy link

Hi have you see a resolution of this ? I have this issue since last revision today...
Regards Yves

@malatestay
Copy link

@xmo-odoo Hello have you an idea of resolution because the error message appears regularly in backoffice and it makes use of ODOO painful.
thank you

@xmo-odoo
Copy link
Collaborator

xmo-odoo commented May 5, 2015

I don't really have an idea no.

This is clearly an issue in calendar, not with JSON itself, apparently the event's recurrence rule string is empty which blows up dateutil. Reading over the code it might happen for an event which:

  • has recurrency set to false, but this is checked before calling get_recurrent_date_by_event
  • has an rrule_type which isn't set

You may want to look at your events, see if there's one with recurrency set/true and no rrule_type. It doesn't seem possible to create that via the UI, but could be for events created programmatically (e.g. by a sync)

@mart-e
Copy link
Contributor

mart-e commented May 5, 2015

You may want to look at your events, see if there's one with recurrency set/true and no rrule_type. It doesn't seem possible to create that via the UI, but could be for events created programmatically (e.g. by a sync)

To do so in the web client:

  1. go to list view of the problematic calendar
  2. create an Advanced Search with "Recurrent is True"
  3. add criteria "Recurrency is not set"

@malatestay
Copy link

@xmo-odoo and @mart-e many thanks for your suggestion i find it and back to you say that i do.

@malatestay
Copy link

@xmo-odoo and @mart-e

Hello,
Based on your suggestion I started looking for events whose fields "recurrent" is true and "rrule" is empty.

Then I realized that some unidentified event "name" = "Busy (s)" that did not count "startdate". It is by removing these record that the error message disappeared.

To describe the context of the use of ODOO calendar I should clarify:

  • I use for my Oulook profesional use.
  • I use a synchronization tool between Oulook and Google Calendar because I need to provide my agenda towards outsider.
  • That's what Google calendar that is synchronized with ODOO.

I still found the étonanntes things:

  • When I look at the number of recording "calendar.event" it is 1492.
  • When I look at the number of calendar event Odoo it is 23577! I see that the repetitive events are listed in this view which does not seem to me sensible.

Finally I did not understand the generation of invalid events from Google Calendar because I have failed to see a relationship, hence my question on the Odoo synchronization tool between the two calendars.

I remain at your disposal if you want more information.
Thank you for your help
Yves

@mart-e
Copy link
Contributor

mart-e commented May 6, 2015

Our guess is that you have one recurrent event in a format that odoo does not support (e.g. repeat every hour). Instead of ignoring this event, it seems to make crash the system (bug).

Regarding the number of events it's simply the recurrent events. odoo will display one record for each occurrence of an event so 1 calendar.event in the database can give 10 records in the list view.

Strange the search did not work.
If you can debug your system, try applying this patch that will log the event that can not be processed (temporary fix, only hidding the error).

diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py
index 28edd84..13c8361 100644
--- a/addons/calendar/calendar.py
+++ b/addons/calendar/calendar.py
@@ -709,7 +709,11 @@ class calendar_event(osv.Model):
         ## Convert the start date to saved timezone (or context tz) as it'll
         ## define the correct hour/day asked by the user to repeat for recurrence.
         startdate = startdate.astimezone(timezone)  # transform "+hh:mm" timezone
-        rset1 = rrule.rrulestr(str(event.rrule), dtstart=startdate, forceset=True)
+        try:
+            rset1 = rrule.rrulestr(str(event.rrule), dtstart=startdate, forceset=True)
+        except ValueError:
+            _logger.error("Could not process event %s (id %s)" % (event.name, event.id))
+            return []
         ids_depending = self.search(cr, uid, [('recurrent_id', '=', event.id), '|', ('active', '=', False), ('active', '=', True)], context=context)
         all_events = self.browse(cr, uid, ids_depending, context=context)
         for ev in all_events:

The other option is to check in database the rrule of all the events that have recurrency = true if one is not set or suspicous (but of course depending of the number of recurrent events you have).

@Yenthe666
Copy link
Collaborator

Hi @missilefish,

Thank you for your bug report.
At this point Odoo 8 is no longer supported as Odoo only supports three versions (9.0, 10.0, 11.0 at the moment).
If you can still reproduce this issue on Odoo 9, Odoo 10 or Odoo 11 we encourage you to create a new bug report.

Regards,
Yenthe

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

5 participants