[Geoserver-devel] Random failure in gs-metadata keeps on breaking builds...

Hi all,
I was checking a random failure in gs-metadata module, that is breaking the builds on Github and the build server (there are others, this one is popping up frequently though).

The logs are ridden with 300+ instances of errors similar to this one:

Nov 27, 2023 6:22:16 PM org.geoserver.metadata.data.service.impl.ConfigurationServiceImpl readConfiguration

SEVERE: Cannot construct instance of org.geoserver.metadata.data.dto.impl.MetadataConfigurationImpl (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value (‘klopt-niets-van’)
at [Source: (org.geoserver.platform.resource.FileSystemResourceStore$FileSystemResource$1); line: 1, column: 1]
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of org.geoserver.metadata.data.dto.impl.MetadataConfigurationImpl (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value (‘klopt-niets-van’)
at [Source: (org.geoserver.platform.resource.FileSystemResourceStore$FileSystemResource$1); line: 1, column: 1]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1739)
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1364)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer._deserializeFromString(StdDeserializer.java:311)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromString(BeanDeserializerBase.java:1504)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:197)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:187)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4825)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3809)
at org.geoserver.metadata.data.service.impl.ConfigurationServiceImpl.readConfiguration(ConfigurationServiceImpl.java:195)

A few things:

  • The exception is per se legit, one cannot load a MetadataConfigurationImpl from a YAML file that contains only the string ‘klopt-niets-van’)
  • The code is just logging the error… but making a lot of noise about it, especially at the current SEVERE logging level. More so considering that the code is blindly looping over files in a directory and trying to deserialize 3 different types of clases in turn, try the next if one fails. This needs to be fixed, we cannot have tests logging so loudly for nothing (nor we should have runtime code doing so).
  • For all the noise it’s making, it’s not the actual cause of the failure.
    Niels could you please remove this wall of text from our build execution?

Now, going to the actual failure, it’s just one:

[ERROR] Tests run: 6, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.447 s <<< FAILURE! - in org.geoserver.metadata.web.TemplatePageTest
[ERROR] testPageNewSave(org.geoserver.metadata.web.TemplatePageTest)  Time elapsed: 0.043 s  <<< ERROR!
java.lang.NullPointerException
	at org.geoserver.metadata.web.TemplatePageTest.before(TemplatePageTest.java:37)

At line 37 the only NPE I see [happening](http://not so random?), is having the tester field being null.
That should not be happening, because JUnit ensures that the @anonymised.com methods of a parent class are run before the ones of the children, and we have this.

However… the tests are not using vanilla JUnit, but Spring own test runner, which runs the tests in a different way. Maybe that’s why it’s happening?

Thad said, the occurrence of the failure has become so common that we should probably just disable these tests, until they can get fixed. Or maybe, better, rewrite them to use GeoServer integration test support, which is generally better known in this community?

Cheers
Andrea

···

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail

Hello Andrea,

You are right on both accounts; that stacktrace should not pollute the output.

The other error indeed… shouldn’t happen. The spring test runner does not change the behavior of the order of before calls. I cannot find any information on this happening to other people, and the code of that that runner class suggests it should be the same. I am quite perplexed. I am looking for a work-around that should prevent this from ever happening.

Pull request is on its way.

Regards

Niels

···

On 27/11/2023 19:16, Andrea Aime wrote:

Hi all,
I was checking a random failure in gs-metadata module, that is breaking the builds on Github and the build server (there are others, this one is popping up frequently though).

The logs are ridden with 300+ instances of errors similar to this one:

Nov 27, 2023 6:22:16 PM org.geoserver.metadata.data.service.impl.ConfigurationServiceImpl readConfiguration

SEVERE: Cannot construct instance of org.geoserver.metadata.data.dto.impl.MetadataConfigurationImpl (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value (‘klopt-niets-van’)
at [Source: (org.geoserver.platform.resource.FileSystemResourceStore$FileSystemResource$1); line: 1, column: 1]
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of org.geoserver.metadata.data.dto.impl.MetadataConfigurationImpl (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value (‘klopt-niets-van’)
at [Source: (org.geoserver.platform.resource.FileSystemResourceStore$FileSystemResource$1); line: 1, column: 1]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1739)
at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1364)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer._deserializeFromString(StdDeserializer.java:311)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromString(BeanDeserializerBase.java:1504)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:197)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:187)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4825)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3809)
at org.geoserver.metadata.data.service.impl.ConfigurationServiceImpl.readConfiguration(ConfigurationServiceImpl.java:195)

A few things:

  • The exception is per se legit, one cannot load a MetadataConfigurationImpl from a YAML file that contains only the string ‘klopt-niets-van’)
  • The code is just logging the error… but making a lot of noise about it, especially at the current SEVERE logging level. More so considering that the code is blindly looping over files in a directory and trying to deserialize 3 different types of clases in turn, try the next if one fails. This needs to be fixed, we cannot have tests logging so loudly for nothing (nor we should have runtime code doing so).
  • For all the noise it’s making, it’s not the actual cause of the failure.
    Niels could you please remove this wall of text from our build execution?

Now, going to the actual failure, it’s just one:

[ERROR] Tests run: 6, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.447 s <<< FAILURE! - in org.geoserver.metadata.web.TemplatePageTest
[ERROR] testPageNewSave(org.geoserver.metadata.web.TemplatePageTest)  Time elapsed: 0.043 s  <<< ERROR!
java.lang.NullPointerException
	at org.geoserver.metadata.web.TemplatePageTest.before(TemplatePageTest.java:37)

At line 37 the only NPE I see happening, is having the tester field being null.
That should not be happening, because JUnit ensures that the @anonymised.com methods of a parent class are run before the ones of the children, and we have this.

However… the tests are not using vanilla JUnit, but Spring own test runner, which runs the tests in a different way. Maybe that’s why it’s happening?

Thad said, the occurrence of the failure has become so common that we should probably just disable these tests, until they can get fixed. Or maybe, better, rewrite them to use GeoServer integration test support, which is generally better known in this community?

Cheers
Andrea

== GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information. == Ing. Andrea Aime @geowolf Technical Lead

GeoSolutions Group phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail

Thank you!

Cheers
Andrea

···

== GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information. == Ing. Andrea Aime @geowolf Technical Lead

GeoSolutions Group phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail