cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the date caused Alfresco NOT to start up

jl
Champ in-the-making
Champ in-the-making
Dear All & Alfresco engineer,

I have encounter some flaws in Alfresco
I am testing it the Alfresco 2.1
Serious enough that I hope some engineers will give us some way to overcome this.

Alfresco will not start up.

STEP 1
Audit needs to be turned on.
i.e. audit configuration
in
/WEB-INF/classes/alfresco/auditConfig.xml
enabled="true"

STEP 2
Fast forward the computer date
e.g. to year 2009 OR to next month OR to next day… etc
Start up Alfresco server
(You may or may not do something in between)
Shutdown Alfresco server

STEP 3
Return the date back to today's date.
Try start up Alfresco server


Alfresco server will have some problem with reading table alf_audit_date…
therefore can not start up the system.
Please note Alfreso 2.1 will start only if the date & time is passed and/or reached.

Scenerio:
Auditing is an absolute necessity for most organization!
[1] If day light saving is used, this may cause error or have some impact.
[2] If by some mistake the time is set forward too much.
    This mistake will have greatly impact anything on the server
    and for the whole alfresco repository system.

    The repository and company folders are then inaccessible (for those who have no idea what is going on) and the database is ruined till those time are reached!

thanks,
jl
6 REPLIES 6

andy
Champ on-the-rise
Champ on-the-rise
Hi

This sounds like a bug in the way auditing manages date objects. I will take a look and fix.

Andy

jl
Champ in-the-making
Champ in-the-making
Thank you Andy,

We are fairly worried that clients, the admin on existing live system playing around with their server's date, if accidentally or not, set the date 10 years ahead!

For that simple act will cause all their
folder & files on the system to be inaccessible and not be auditable. :?

Please tell us what area and code
we can fix to have this bug resolved.


Smiley Very Happy thank you,
jl

andy
Champ on-the-rise
Champ on-the-rise
Hi

The use of AuditDateImpl.getLatestDate is the problem (and a bit dense of me…)

Andy

henk
Champ in-the-making
Champ in-the-making
There are other small bugs (linux) I would like to mention too:

- If IP address changes Alfresco won't start anymore (fixed this by editting the hosts file in linux)
- If you change the name of the linux box Alfresco will stop working too (fixed this if you edit it also in the hosts file)

Hope there will be some dynamic solution sometime Smiley Tongue

mikef
Champ in-the-making
Champ in-the-making
Are you running your database on the same box? Is it possible that your database connection is hardcoded to an IP or hostname?

jl
Champ in-the-making
Champ in-the-making
Hi Andy,

The use of AuditDateImpl.getLatestDate is the problem (and a bit dense of me…)
thank you for finding the problem. : )

I can see in
org.alfresco.repo.audit.hibernate.HibernateAuditDAO.getAuditDate
the method AuditDateImpl.getLatestDate is used.
And it is to get the maximum id (natively generated by the database)
as described in Audit.hbm.xml

I see the problem may lies in the code HibernateAuditDAO.getAuditDate
where in the while loop with every loop it is incrementing the date taken from alf_audit_date database by 1 day each time
and then compare it to "AuditState auditInfo"'s date…
(both date having set hr, min, sec, millisec as 0)


        while (!required.equals(auditDate.getDate()))
        {
            Date nextDate = Duration.add(auditDate.getDate(), new Duration("P1D"));
            auditDate = new AuditDateImpl(nextDate);
            getSession().save(auditDate);
            auditDateImplId.set(Long.valueOf(auditDate.getId()));
        }

we still have to change the code to make it runs…
have you got fix and have the solution? please post it : )
(I am testing on alfresco 2.1)

How are we going to change this
so getting latest date that might be 10 years ahead,
will not ruin the alfresco to load
and have it running normal and its audit module will work as usual?

I am thinking of modifying this simply to

        if (!required.equals(auditDate.getDate()))
        {
            auditDate = new AuditDateImpl(required);
            getSession().save(auditDate);
            auditDateImplId.set(Long.valueOf(auditDate.getId()));
        }
without the unnecessary while loop and having the date set hopefully back from perhaps 10 years ahead to today's date!?
If "AuditState auditInfo"'s date which is variable "required" - is today's date.


Result
I  tested fast foward the date a month ahead, then reverse the date back to today's date.
Shut server down each down and start it up.

The good news:
The alfresco 2.1 seem to be working with this change.


The not as good news:
(1)
However I can not guarantee that this won't affect any audit relating things?
If ok please tell me if that will work ok with the rest of application : )
(2)
Also I find alfresco can not cope with me fast forwarding the date while it is running. After fast forward the date (a month) without shutting alfresco server down. It automatically log me out, and when I login…
I waited and waited…
alfresco server - the JVM memory then keeps on climbing…
It seem to be in an infinite loop…

This I think is a sort of defect… at least is not as critical as previous one, can live with.

Thank you.
jl
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.