You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by "Roll, Kevin" <Ke...@idexx.com> on 2016/03/16 21:24:34 UTC

Configuration data types

We've been using the OSGi configuration mechanism in our Sling application for about four months without any problems. Suddenly we ran into an issue on a test machine today... the configuration file was missing data types. For example, an entry that should look like

com.idexx.imaging.imagemanager.retryTimes=I"5"

now looks like

com.idexx.imaging.imagemanager.retryTimes="5"

In other words, the parameter mysteriously became a String. The code that parsed this configuration, i.e. the method

    @Activate
    @Modified
    public void configure(final Map<String, Object> props)

did not handle this properly and needed to be fixed. I've made that fix, but I'm still baffled as to how this happened and why we never saw this in four months of diligent testing. I dug into Felix a bit and found that the code that writes these files [1] *always* writes the data type, *unless* that type happens to be String. So it seems that whatever called Felix in order to write the configuration decided to change all of the types to String. I'm at a loss to explain this. I am unable to reproduce this by changing values through the Sling Configuration console. Does anyone have any idea what might be happening here? Thanks!

[1] http://grepcode.com/file/repo1.maven.org/maven2/org.apache.felix/org.apache.felix.configadmin/1.6.0/org/apache/felix/cm/file/ConfigurationHandler.java#ConfigurationHandler.writeType%28java.io.Writer%2Cjava.lang.Class%29


RE: Configuration data types

Posted by "Roll, Kevin" <Ke...@idexx.com>.
After further investigation I isolated the problem to a timing issue in Felix. There is a tiny window of time where the Felix configuration manager is ready to accept requests but our bundle had not started yet. Our main application POSTs configuration over to Sling, and it managed to hit that time window. I was able to reproduce it by spamming the Sling server with configuration POSTs while it was starting up.

We were launching our own bundle with level 20... I changed it to level 0 and the problem went away, presumably because the configuration metadata is immediately available.

-----Original Message-----
From: Bertrand Delacretaz [mailto:bdelacretaz@apache.org] 
Sent: Thursday, March 17, 2016 6:15 AM
To: users
Subject: Re: Configuration data types

Hi,

On Wed, Mar 16, 2016 at 9:24 PM, Roll, Kevin <Ke...@idexx.com> wrote:
> ...I dug into Felix a bit and found that the code that writes these files [1]
> *always* writes the data type, *unless* that type happens to be String...

I have no idea what's going on but suggest setting a breakpoint in
that method to check what calls it with incorrect values.

-Bertrand

Re: Configuration data types

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Wed, Mar 16, 2016 at 9:24 PM, Roll, Kevin <Ke...@idexx.com> wrote:
> ...I dug into Felix a bit and found that the code that writes these files [1]
> *always* writes the data type, *unless* that type happens to be String...

I have no idea what's going on but suggest setting a breakpoint in
that method to check what calls it with incorrect values.

-Bertrand