gbif / registry

GBIF Registry
Apache License 2.0
34 stars 15 forks source link

GRSciColl - Response 500 when trying to access more than 600 suggestions for institutions #570

Closed ManonGros closed 4 months ago

ManonGros commented 4 months ago

I am trying to make statistics about editing and update suggestions on GRSciColl but if I try this API call, I get a There was an unexpected error (type=Internal Server Error, status=500).:

https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=300&offset=600

MortenHofft commented 4 months ago

Works: https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=1&offset=646 fails: https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=1&offset=647

the issue isn't the offset, but the record

E.g. https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=1&offset=649 works

ahakanzn commented 4 months ago

I think this is related to offset and the limit, there are 648 record so it fails we try to retrieve more than that: https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=1&offset=647 -> **works - returns the last record https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=1&offset=648 -> fails - there is no 649th record**

https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=300&offset=600 fails so if we want to get the records between 600 and 648 it should be https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=48&offset=600

MattBlissett commented 4 months ago

It's probably the particular record.

Works: https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=1&offset=647

Fails: https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=1&offset=648

Fails: https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=1&offset=649

Works https://api.gbif.org/v1/grscicoll/institution/changeSuggestion?limit=1&offset=650

The error is

java.lang.IllegalStateException: Couldn't read json: {"key": "58d43d88-b353-48ac-90d7-25e058d79360", "code": "CSIC-IEO-CADIZ", "name": "Instituto Español de Oceanografía. Centro Oceanográfico de Cádiz (CSIC)", "tags": [], "email": ["eli.munoz@ieo.csic.es"], "phone": ["+34956294189"], "active": true, "address": {"key": 43341, "city": "Cádiz", "address": "Puerto Pesquero, Muelle de Levante, S/N", "country": "ES", "province": "Cádiz", "postalCode": "11006"}, "created": "2022-03-18T10:02:33.678+00:00", "logoUrl": "https://www.gbif.es/wp-content/uploads/2013/09/Centro-oceanografico-de-Cadiz-Gijon-Malaga-INTITUTO-ESPANOL-DE-OCEANOGRAFIA.png", "comments": [], "contacts": [], "homepage": "http://www.ieo.es/", "modified": "2022-09-20T10:58:08.603+00:00", "createdBy": "katia", "catalogUrl": "https://www.gbif.es/coleccion/coleccion-de-crustaceos-decapodos-y-estomatopodos-del-centro-oceanografico-de-cadiz/", "modifiedBy": "katia", "description": "The IEO-CSIC National Center, dependent on the Ministry of Science and Innovation, created in 1914, has been dedicated to research in marine sciences, especially in relation to scientific knowledge of the oceans, the sustainability of fishing resources and the marine environment. In addition to his dedication to basic and applied research, he also provides scientific and technological advice to administrations on matters related to oceanography and marine sciences. The IEO-CSIC has its headquarters in Madrid and nine coastal oceanographic centers, many of which have important zoological collections, made available to the international scientific community. The Oceanographic Center of Cadiz (COCAD) is located in the Fishing Dock of the city of Cadiz and has a Collection of Crustaceans (CRUST-IEOCD), in turn made up of two sub-collections: 1) Collection of Decapod and Stomatopod Crustaceans (CCDE-IEOCD) and 2) Collection of Other Crustaceans (OCRUST-IEOCD).", "disciplines": ["OCEAN_MARINE_BIOLOGY_AND_BIOLOGICAL_OCEANOGRAPHY"], "identifiers": [], "machineTags": [], "foundingDate": "1914-10-01T00:00:00.000+00:00", "masterSource": "GRSCICOLL", "contactPersons": [{"fax": [], "key": 33207, "city": "Cádiz", "email": ["eli.munoz@ieo.csic.es"], "phone": ["+34 956 294189"], "address": ["Puerto Pesquero, Muelle de Levante, s/n"], "country": "ES", "created": "2022-09-20T10:56:40.942+00:00", "primary": true, "userIds": [], "lastName": "Muñoz", "modified": "2022-09-20T10:56:40.942+00:00", "position": ["Collection manager and curator"], "province": "Cádiz", "createdBy": "katia", "firstName": "Isabel", "modifiedBy": "katia", "postalCode": "11006", "taxonomicExpertise": []}], "mailingAddress": {"key": 44275, "city": "Cádiz", "address": "Puerto Pesquero, Muelle de Levante, s/n", "country": "ES", "province": "Cádiz", "postalCode": "11006"}, "additionalNames": [], "alternativeCodes": [], "displayOnNHCPortal": true, "occurrenceMappings": [], "taxonomicDescription": "Marine Crustacean", "geographicDescription": "African and european waters", "indexHerbariorumRecord": false, "institutionalGovernance": "STATE"}
        at org.gbif.registry.service.collections.suggestions.BaseChangeSuggestionService.readJson(BaseChangeSuggestionService.java:810)
        at org.gbif.registry.service.collections.suggestions.BaseChangeSuggestionService.dtoToChangeSuggestion(BaseChangeSuggestionService.java:753)

You can see from .count there are 930 records in total.

ahakanzn commented 4 months ago

Problematic records have been corrected. Issue is resolved on prod