[ 
https://issues.apache.org/jira/browse/FELIX-4924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14591631#comment-14591631
 ] 

Carsten Ziegeler commented on FELIX-4924:
-----------------------------------------

[~neilwightman] Did you try a config admin version with the patch you suggest?

> ConfigAdmin update results in empty file or corrupt file.
> ---------------------------------------------------------
>
>                 Key: FELIX-4924
>                 URL: https://issues.apache.org/jira/browse/FELIX-4924
>             Project: Felix
>          Issue Type: Bug
>          Components: Configuration Admin
>    Affects Versions: configadmin-1.4.0, configadmin-1.8.0
>         Environment: Windows Server 2003 + 2008.
> Redhat 
> Centos
>            Reporter: Neil Wightman
>
> We have been hitting a rare but consistent problem with config admin.
> The problem is that a config admin file is becoming corrupt.  I.e the file 
> will contain only NULL characters.  Last time this happened the config file 
> had 1080 NULL characters in it.
> This seems to occur when a config is being updated as the JVM is stopping / 
> shutting down.
> All the code in the FilePersistenceManager._store() method looks good and 
> safe but this issue still keeps occuring. 
> We it occur 3 times last week out of a few hundred servers.
> I think the problem is that the new File being written is not being flushed 
> to disk in time.
> I think ConfigAdmin needs to ensure the new config is flushed to disk after 
> the close.
> {code}
>             tmpFile = File.createTempFile( cfgFile.getName(), TMP_EXT, cfgDir 
> );
>             out = new FileOutputStream( tmpFile );
>             ConfigurationHandler.write( out, props );
>             out.close();
>             try 
>             {
>                 // attempt force to sync to disk
>                 out.getFD().sync();
>             }
>             catch (SyncFailedException sync) 
>             {
>                 // ignore
>             }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to