2.12.2: REST API for tags sometimes returns an empty list

173 views
Skip to first unread message

Steve Butler

unread,
May 23, 2016, 8:30:15 PM5/23/16
to Repo and Gerrit Discussion
Hi,

Has anyone else seen this behavior?

On two different Gerrit servers, both running 2.12.2, we often get wrong answers for a simple "give me TagInfo JSON for all tags in project" request.  

Sometimes the response contains all tags (2800 in one repository), and other times just 100 or so, or even an empty JSON list.  It seems to affect all our projects. Paging (using the "r" and "s" parameters) doesn't help.  The repository browsers (we're using both GitBlit and Gitiles at the moment) shows all tags correctly.  I suppose they don't depend on this REST API.

Any advice on how to troubleshoot the problem?

Thanks,
Steve

David Pursehouse

unread,
May 23, 2016, 9:22:34 PM5/23/16
to Steve Butler, Repo and Gerrit Discussion
On Tue, May 24, 2016 at 9:30 AM Steve Butler <stephen...@hamburgsud.com> wrote:
Hi,

Has anyone else seen this behavior?

On two different Gerrit servers, both running 2.12.2, we often get wrong answers for a simple "give me TagInfo JSON for all tags in project" request.  

Sometimes the response contains all tags (2800 in one repository), and other times just 100 or so, or even an empty JSON list.  

Is this behaviour in the same project? I.e. it sometimes returns all tags for that project, and sometimes not?  Or is it on specific projects that some tags are missing?

In the latter case, please check if there's anything different about the missing tags compared to ones that are being returned.

You could also try to call the "Get Tag" REST API for one of the tags that are not shown:



Also, are you seeing anything in the error logs server side?

 
It seems to affect all our projects. Paging (using the "r" and "s" parameters) doesn't help.  The repository browsers (we're using both GitBlit and Gitiles at the moment) shows all tags correctly.  I suppose they don't depend on this REST API.

Any advice on how to troubleshoot the problem?

Thanks,
Steve

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Butler, Stephen

unread,
May 24, 2016, 7:35:40 AM5/24/16
to David Pursehouse, Repo and Gerrit Discussion
From: David Pursehouse [mailto:david.pu...@gmail.com]
> Sent: Tuesday, May 24, 2016 3:22
> To: Butler, Stephen; Repo and Gerrit Discussion
> Subject: Re: 2.12.2: REST API for tags sometimes returns an empty list
>
> On Tue, May 24, 2016 at 9:30 AM Steve Butler <stephen...@hamburgsud.com> wrote:
> > Hi,
> >
> > Has anyone else seen this behavior?
> >
> > On two different Gerrit servers, both running 2.12.2, we often get wrong answers for a simple "give me TagInfo JSON for all tags in project" request.
> >
> You could also try to call the "Get Tag" REST API for one of the tags that are not shown:
>
> curl --digest --netrc 'https://gerrit.example.com/gerrit/a/projects/Foo%2FBar/tags/my-missing-tag'

Listing individual tags (via 'GET /projects/{project-name}/tags/{tag-id}') is working fine, as is the Gerrit UI's "Tags" view. So the underlying data seems to be sound.

>
> Also, are you seeing anything in the error logs server side?

There were no new entries in the server error_log file. The /tags/ API without parameters seems to use parameter values cached from an earlier request.

$ curl -s --digest --netrc 'https://gerrit.example.com/gerrit/a/projects/Foo%2FBar/tags/?s=1000&n=1' | grep '"ref": ' | wc -l
1

$ curl -s --digest --netrc 'https://gerrit.example.com/gerrit/a/projects/Foo%2FBar/tags/' | grep '"ref": ' | wc -l
1

The second command should have printed "2720". We found a workaround: set the "skip" (s) parameter to 0 and the "limit" (n) parameter to -1.

$ curl -s --digest --netrc 'https://gerrit.example.com/gerrit/a/projects/Foo%2FBar/tags/?s=0&n=-1' | grep '"ref": ' | wc -l
2720

Thanks,
Steve

__________________________________
Stephen Butler
Hamburg Südamerikanische Dampfschifffahrts-Gesellschaft KG
Registered Office: Hamburg, Germany
Commercial Register: Amtsgericht Hamburg HRA 59448

David Pursehouse

unread,
May 24, 2016, 8:21:44 AM5/24/16
to Butler, Stephen, Repo and Gerrit Discussion
On Tue, May 24, 2016 at 8:35 PM Butler, Stephen <Stephen...@hamburgsud.com> wrote:
From: David Pursehouse [mailto:david.pu...@gmail.com]
> Sent: Tuesday, May 24, 2016 3:22
> To: Butler, Stephen; Repo and Gerrit Discussion
> Subject: Re: 2.12.2: REST API for tags sometimes returns an empty list
>
> On Tue, May 24, 2016 at 9:30 AM Steve Butler <stephen...@hamburgsud.com> wrote:
> > Hi,
> >
> > Has anyone else seen this behavior?
> >
> > On two different Gerrit servers, both running 2.12.2, we often get wrong answers for a simple "give me TagInfo JSON for all tags in project" request.
> >
> You could also try to call the "Get Tag" REST API for one of the tags that are not shown:
>
>   curl --digest --netrc 'https://gerrit.example.com/gerrit/a/projects/Foo%2FBar/tags/my-missing-tag'

Listing individual tags (via 'GET /projects/{project-name}/tags/{tag-id}') is working fine, as is the Gerrit UI's "Tags" view.  So the underlying data seems to be sound.

>
> Also, are you seeing anything in the error logs server side?

There were no new entries in the server error_log file.  The /tags/ API without parameters seems to use parameter values cached from an earlier request.


Sounds like a bug. Just out of interest, do you see the same kind of behaviour with the /branches/ API?  The reason I ask is because the tags API implementation was based largely on the /branches/ API so it's possible they both suffer the same problem.  (although if that's the case I'm surprised it hasn't been reported before).

Butler, Stephen

unread,
May 25, 2016, 11:33:15 AM5/25/16
to David Pursehouse, Repo and Gerrit Discussion
On Tuesday, May 24, 2016 14:22 David Pursehouse <david.pu...@gmail.com> wrote:

> On Tue, May 24, 2016 at 8:35 PM Butler, Stephen <Stephen...@hamburgsud.com> wrote:
> > From: David Pursehouse [mailto:david.pu...@gmail.com]
> > > Sent: Tuesday, May 24, 2016 3:22
> > > To: Butler, Stephen; Repo and Gerrit Discussion
> > > Subject: Re: 2.12.2: REST API for tags sometimes returns an empty list
> > >
> > > On Tue, May 24, 2016 at 9:30 AM Steve Butler <stephen...@hamburgsud.com> wrote:
> > > > Hi,
> > > >
> > > > Has anyone else seen this behavior?
> > > >
> > > > On two different Gerrit servers, both running 2.12.2, we often get wrong answers for a simple "give me TagInfo JSON for all tags in project" request.
> > > >
> > > You could also try to call the "Get Tag" REST API for one of the tags that are not shown:
> > >
> > > curl --digest --netrc 'https://gerrit.example.com/gerrit/a/projects/Foo%2FBar/tags/my-missing-tag'
> >
> > Listing individual tags (via 'GET /projects/{project-name}/tags/{tag-id}') is working fine, as is the Gerrit UI's "Tags" view. So the underlying data seems to be sound.
> >
> > >
> > > Also, are you seeing anything in the error logs server side?
> >
> > There were no new entries in the server error_log file. The /tags/ API without parameters seems to use parameter values cached from an earlier request.
>
> Sounds like a bug. Just out of interest, do you see the same kind of behaviour with the /branches/ API? The reason I ask is because the tags API implementation was based largely on the /branches/ API so it's possible they both suffer the same problem. (although if that's the case I'm surprised it hasn't been reported before).
>

The problem doesn't occur with the /branches/ API.

Thanks for your help.

周晓庆

unread,
Apr 12, 2018, 9:03:36 AM4/12/18
to Repo and Gerrit Discussion
Did you solve this problem? 
I found that when the numbers of tags getting from restful api is much less than the repo has, open the gerrit website, and search the tags on project's tag page, the get it from api again, it's ok now...
But a fewer hours or days latter, the problem will still back ...

在 2016年5月25日星期三 UTC+8下午11:33:15,Steve Butler写道:

Matthew Webber

unread,
Apr 12, 2018, 9:47:55 AM4/12/18
to Repo and Gerrit Discussion
On Thursday, 12 April 2018 14:03:36 UTC+1, 周晓庆 wrote:
Did you solve this problem? 
I found that when the numbers of tags getting from restful api is much less than the repo has, open the gerrit website, and search the tags on project's tag page, the get it from api again, it's ok now...
But a fewer hours or days latter, the problem will still back ...

On what version of Gerrit are you seeing the problem?

周晓庆

unread,
Apr 13, 2018, 12:35:53 AM4/13/18
to Repo and Gerrit Discussion
v2.12

在 2018年4月12日星期四 UTC+8下午9:47:55,Matthew Webber写道:
Reply all
Reply to author
Forward
0 new messages