Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 310545 - changed Bugzilla tasks occasionally do not show as incoming
Summary: changed Bugzilla tasks occasionally do not show as incoming
Status: VERIFIED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 critical with 1 vote (vote)
Target Milestone: 3.8.3   Edit
Assignee: Steffen Pingel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-26 16:57 EDT by Thomas Ehrnhoefer CLA
Modified: 2013-01-10 07:12 EST (History)
7 users (show)

See Also:


Attachments
mylyn/context/zip (46.28 KB, application/octet-stream)
2012-11-17 10:49 EST, Frank Becker CLA
no flags Details
mylyn/context/zip (6.31 KB, application/octet-stream)
2012-12-08 15:33 EST, Frank Becker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Ehrnhoefer CLA 2010-04-26 16:57:20 EDT
I have two queries against a repository, one of them having ~4000 tasks, the other ~500.
Those queries cover all tasks of the repository I have access to.
Ocasionally I open a task (which had no incoming decoration) and suddently get the editor header message "incoming changes". Clicking it shows for example a comment added a while ago (and in the meantime I got plenty of incoming notifications on other tasks of the same query).

I have seen this a couple of times, it always appears random as I do see incomings in the task list for other tasks, and I can't make out why this exact task is different.

Shawn mentioned that the big query could be a problem there, but could it delay those incomings for that long, and shouldn't I see a warning next to the query if it somehow failed?
Comment 1 Thomas Ehrnhoefer CLA 2010-04-27 13:07:34 EDT
I just did a "synchronize all tasks" on the repository in question...
On the almost 5300 tasks in the 2 queries I had 16 tasks having comments (from up to about 3 weeks ago) which did not show up before. Those tasks were in different queries. Overall 103 tasks changed in in the last 3 weeks.

I do recall some error I had a while ago (might be about 3 weeks, not sure) about mylyn and something about workspace (really don't remember much, error log cleared). Shawn suggest that an issue might be that the last-synced date is set before the incoming state is successfully written to disc and thus doesn't show up. Don't know about the internals there, so I have no idea.
Comment 2 Steffen Pingel CLA 2010-07-09 21:35:49 EDT
Steps to reproduce this issue would be very helpful.
Comment 3 Thomas Ehrnhoefer CLA 2010-07-09 23:50:06 EDT
(In reply to comment #2)
> Steps to reproduce this issue would be very helpful.

I totally agree. Can't reproduce it, and ever since I set up a whole new workspace (and tasklist), that problem has not shown (it's been over a month)
Comment 4 Thomas Ehrnhoefer CLA 2010-07-12 14:05:31 EDT
Actually Steffen, I did a "Synchronize all tasks" on a repository (from the context menu in the task repositories view) where I have over 6000 tasks in total in the task list of, and got 3 missing incomings (one 6 weeks ago, one about 3, one 1 week ago).
The incomings had comments/attachments/resolution changed (not all had all those changes - but they all were pretty common changes I see incomings for all the time).
Comment 5 Andrew Gvozdev CLA 2010-07-15 18:13:12 EDT
I see it also more or less regularly. I have a query showing changed tasks (i.e. tasks "changed in 1 days"). Sometimes new tasks appear in the list but not marked as incoming. When I double-click on it it shows that there are changes and then updates the contents. I believe in a while those would show as incoming even if I don't touch them. Not sure how to reproduce that either.
Comment 6 Tobias Oberlies CLA 2012-11-06 11:41:30 EST
I'm also seeing the same problem with a query of only 90 tasks from the Eclipse.org bugzilla.
Comment 7 Thomas Ehrnhoefer CLA 2012-11-06 11:58:05 EST
Yeah, I am still seeing this regularly. Steps to reproduce is simply "sync all tasks" periodically and suddently seeing incomings that are old.
Comment 8 Tobias Oberlies CLA 2012-11-09 04:38:05 EST
This bug is cutting me off from the community: I comment somewhere and never get notified that there are responses&follow-up questions. This reneders Mylyn close to useless for me! Raising to critical.
Comment 9 Steffen Pingel CLA 2012-11-12 14:53:45 EST
I have also noticed this. Frank, when we last investigated this we identified two areas that could be problematic:

* BugzillaRepositoryConnector.preSynchronization() assumes that the maximum request size is 7 kb. I think in the past we have had servers silently cut off requests that were over the limit. Not sure if 7 kb assumption is still valid.

* BugzillaRepositoryConnector.postSynchronization() uses the modification timestamp of any task in the task list. If a task is opened while a synchronization is running and it has had a subsequent change the modification time stamp that is used in postSynchronization() doesn't match the query result any more and the next query would use a time stamp that is too recent missing incomings in between.

I think Bugzilla returns the modification time stamp as part of the query results so we might be able to make the time stamp logic much more robust using the extra data that we get back.
Comment 10 Frank Becker CLA 2012-11-17 10:46:14 EST
(In reply to comment #9)
> I have also noticed this. Frank, when we last investigated this we identified
> two areas that could be problematic:
> 
> * BugzillaRepositoryConnector.preSynchronization() assumes that the maximum
> request size is 7 kb. I think in the past we have had servers silently cut off
> requests that were over the limit. Not sure if 7 kb assumption is still valid.
> 
> * BugzillaRepositoryConnector.postSynchronization() uses the modification
> timestamp of any task in the task list. If a task is opened while a
> synchronization is running and it has had a subsequent change the modification
> time stamp that is used in postSynchronization() doesn't match the query result
> any more and the next query would use a time stamp that is too recent missing
> incomings in between.
The modification time stamp is only used when we not have a time stamp in event.getData().
But event.setData() is called with the query_timestamp from the rdf result and can not be null.
Maybe we should remove the else part in getSynchronizationTimestamp because it can not be executed.What is about 

TaskDataManager.putUpdatedTaskData() here we set an TaskAttribute ITasksCoreConstants.ATTRIBUTE_TASK_SUPPRESS_INCOMING.

Thoughts?
Comment 11 Frank Becker CLA 2012-11-17 10:49:36 EST
Created attachment 223695 [details]
mylyn/context/zip
Comment 12 Steffen Pingel CLA 2012-12-07 10:15:01 EST
I looked at the code that handles the query time stamp and it has severe bugs:

1. There is code to set the query timestamp in queryForChanged() and performQuery(). The former is never executed since the timestamp is set in performQuery().
2. Every query execution updates the timestamp in the session while only the first query for changed tasks should ever do that.

In consequence the timestamp of the query last executed for a repository is taken into account. That means the Bugzilla connector misses most incomings that happen between execution of the first changes query and execution of the last query for the repository. The probability to missing incomings increases with the number of queries and tasks and slowness of the connection. This matches my experience.

I have pushed a proposed fix here: https://git.eclipse.org/r/#/c/9105/. The change is still missing a test case.
Comment 13 Thomas Ehrnhoefer CLA 2012-12-07 10:25:49 EST
Nice find Steffen, this makes perfect sense. I have lots of queries, too, and sometimes the server is really slow, increasing the chances of this to happen.
Comment 14 Frank Becker CLA 2012-12-08 15:33:30 EST
Here is an new patch set with a junit test.
Comment 15 Frank Becker CLA 2012-12-08 15:33:36 EST
Created attachment 224495 [details]
mylyn/context/zip
Comment 16 Steffen Pingel CLA 2012-12-08 17:16:54 EST
Frank, I also created a test and have commented on the review with further details. I have submitted the fix to master and the 3.8.x branch and uploaded a new weekly build.

It'd be great if some of you could try the following steps:

1. Update to the latest master or weekly build
2. Synchronize all tasks for Bugzilla repositories from the context menu of the Task Repositories view
3. Run for a few days/weeks
4. Repeat 2 and check if there are any incomings that should have been reported as part of regular synchronizations
Comment 17 Steffen Pingel CLA 2012-12-13 02:47:19 EST
Frank discovered that there is another problem with the way the timestamp is formatted. It appears that SqlifyDate in Bugzilla's Search.pm ignores the timezone and interprets the timestamp as server local time. 

Frank, we should file a bug against Bugzilla to allow specification of a timezone.

For the connector we'll need to remove the date formatter step and use the date stamp as returned by the server (which should be in server local time).
Comment 18 Steffen Pingel CLA 2012-12-13 02:53:39 EST
I take that back, on second look, the code invokes str2time which does parse timezone properly so this should work as expected: http://search.cpan.org/~gbarr/TimeDate-1.20/lib/Date/Parse.pm.
Comment 19 Steffen Pingel CLA 2012-12-13 03:49:05 EST
Frank, iit looks to me like this indeed a bug in Bugzilla 4.2 (and later):

http://mylyn.org/bugs40/buglist.cgi?chfieldfrom=2012-12-09%2022:40%20CET&bug_id=1 -> 1 bug
http://mylyn.org/bugs40/buglist.cgi?chfieldfrom=2012-12-09%2022:40%20PDT&bug_id=1 -> 0 bugs

http://mylyn.org/bugs42/buglist.cgi?chfieldfrom=2012-12-13%2000:29%20CET&bug_id=1 -> 1 bug
http://mylyn.org/bugs42/buglist.cgi?chfieldfrom=2012-12-13%2000:29%20PDT&bug_id=1 -> 1 bug

It looks like Bugzilla is not properly parsing the timestamp in _timestamp_translate(). It works as expected again if I comment out this line in Search.pm to force parsing of the timestamp: 

 return if $value !~ /^(?:[\+\-]?\d+[hdwmy]s?|now)$/i

We'll have to file a bug against Bugzilla and implement a work around since 4.2 will always interpret the timestamp as local time regardless of the time zone specified and add a test case on our end for this specific problem. Great that you found that!
Comment 20 Steffen Pingel CLA 2012-12-13 04:42:20 EST
Here is a test case that demonstrates the problem. It passes on 4.0 but fails on 4.2: https://git.eclipse.org/r/9214 .
Comment 21 Steffen Pingel CLA 2012-12-13 08:35:13 EST
Here is a fix that should work for all Bugzilla versions: https://git.eclipse.org/r/9216.
Comment 22 Steffen Pingel CLA 2012-12-15 10:03:38 EST
I filed a bug against Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=821997.
Comment 23 Frank Becker CLA 2012-12-16 02:35:39 EST
Steffen I have a new junit test and make sure that this work for all versions and not only for > 4.2
Comment 24 Steffen Pingel CLA 2012-12-16 08:12:24 EST
(In reply to comment #23)
> Steffen I have a new junit test and make sure that this work for all versions
> and not only for > 4.2

Unfortunately we can't make the test pass on 4.2 since querying with a timezone is broken on Bugzilla 4.2/4.4. Frank, we should push to get https://bugzilla.mozilla.org/show_bug.cgi?id=674503 fixed for 4.2.4 and 4.4.0. 

In the meantime I would like to use the fix that I already submitted. I tested it on 3.6 and 4.0 with the vagrant configurations and that worked as expected. Is that still failing for you?

If we can avoid it I would like to keep the current simple logic and not add version checks unless there is a need for that (which I would like to understand first).
Comment 25 Shawn Minto CLA 2012-12-18 16:12:17 EST
Note that I have been running on this for a week or so now and I haven't seen any missing incoming tasks from my BZ repositories.
Comment 26 Steffen Pingel CLA 2012-12-23 09:09:18 EST
Thanks Shawn, I can confirm the same on my end.

Bugzilla issues that we discovered as part of working on this bug are tracked here:

https://bugzilla.mozilla.org/show_bug.cgi?id=674503
https://bugzilla.mozilla.org/show_bug.cgi?id=822629