Alfresco restart breaks URL tickets

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2011 11:45 PM
Hi
I have noticed that restarting the Alfresco service has the result that links to resources (from the Moodle 2.1 virtual learning environment) using authentication tickets in the URL, no longer work. i.e. the tickets are no longer valid.
http://wiki.alfresco.com/wiki/URL_Addressability#Ticket_URL_Argument
Is there any way to make these tickets persistent through Alfresco restarts?
This is essential for Moodle-Alfresco integration to work, at least as currently implemented. It is a common use-case that a teacher will link to resources/files that they own in Alfresco but requires other users (students) to be able to view/access the link. The ticket system provides a neat way to do this, but only if the tickets are persistent (i.e. don't expire).
Many thanks
I have noticed that restarting the Alfresco service has the result that links to resources (from the Moodle 2.1 virtual learning environment) using authentication tickets in the URL, no longer work. i.e. the tickets are no longer valid.
http://wiki.alfresco.com/wiki/URL_Addressability#Ticket_URL_Argument
Is there any way to make these tickets persistent through Alfresco restarts?
This is essential for Moodle-Alfresco integration to work, at least as currently implemented. It is a common use-case that a teacher will link to resources/files that they own in Alfresco but requires other users (students) to be able to view/access the link. The ticket system provides a neat way to do this, but only if the tickets are persistent (i.e. don't expire).
Many thanks
Labels:
- Labels:
-
Archive
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2011 04:08 AM
Hello,
tickets are only held in in-memory caches during the runtime of the server. Tickets can be propagated from one server to another in a cluster, so a hand-over in a cluster is possible. It is not however possible to reuse tickets after a complete shutdown/restart, as the caches are non-persistent. Although entries may overflow to disk, a clean shutdown will clear all cache data. In order to activate persistent caches (no guarantee that it won't break something else, i.e. retain inconsistent data after a restart), you have to modify the / provide a ehcache-custom.xml, which should define the cache as persistent.
ehCache documentation about persistent diskStore
Small example of persistent cache on StackOverflow
Regards.
tickets are only held in in-memory caches during the runtime of the server. Tickets can be propagated from one server to another in a cluster, so a hand-over in a cluster is possible. It is not however possible to reuse tickets after a complete shutdown/restart, as the caches are non-persistent. Although entries may overflow to disk, a clean shutdown will clear all cache data. In order to activate persistent caches (no guarantee that it won't break something else, i.e. retain inconsistent data after a restart), you have to modify the / provide a ehcache-custom.xml, which should define the cache as persistent.
ehCache documentation about persistent diskStore
Small example of persistent cache on StackOverflow
Regards.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2011 05:03 PM
Thanks Axel. That is a really informative post. I'll certainly look into the ehCache option.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2011 07:48 PM
Following on from Axel's pointers
The following appears to make Alfresco URL tickets persistent. I have, so far, cycled through a handful of Alfresco restarts and the URL ticket still works for different users. smile
In Alfresco, copy and rename
/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/ehcache-default.xml
to
/opt/alfresco/tomcat/shared/classes/alfresco/extension/ehcache-custom.xml
Then edit ehcache-custom.xml as follows
Find
<cache
name="org.alfresco.cache.ticketsCache"
maxElementsInMemory="1000"
eternal="true"
overflowToDisk="true"
statistics="false"
/>
and change to
<cache
name="org.alfresco.cache.ticketsCache"
maxElementsInMemory="1000"
eternal="true"
overflowToDisk="true"
diskPersistent="true"
statistics="false"
/>
I'm not completely sure how robust or secure this solution is, but so far it seems to be working.
Also, the default maxElementsInMemory setting looks to be a little on the low side at 1000, though I have not yet changed it. Perhaps it should be 10000 ? or 50000 ? more ?
Thanks again Axel. I, and a few others, had 'hit a brick wall with this' this until your posting
The following appears to make Alfresco URL tickets persistent. I have, so far, cycled through a handful of Alfresco restarts and the URL ticket still works for different users. smile
In Alfresco, copy and rename
/opt/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/ehcache-default.xml
to
/opt/alfresco/tomcat/shared/classes/alfresco/extension/ehcache-custom.xml
Then edit ehcache-custom.xml as follows
Find
<cache
name="org.alfresco.cache.ticketsCache"
maxElementsInMemory="1000"
eternal="true"
overflowToDisk="true"
statistics="false"
/>
and change to
<cache
name="org.alfresco.cache.ticketsCache"
maxElementsInMemory="1000"
eternal="true"
overflowToDisk="true"
diskPersistent="true"
statistics="false"
/>
I'm not completely sure how robust or secure this solution is, but so far it seems to be working.
Also, the default maxElementsInMemory setting looks to be a little on the low side at 1000, though I have not yet changed it. Perhaps it should be 10000 ? or 50000 ? more ?
Thanks again Axel. I, and a few others, had 'hit a brick wall with this' this until your posting
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2011 04:13 AM
Hello,
as long as the overflowToDisk property is active and there is no maxElementsOnDisk, the maxElementsInMemory is not a property that can limit the maximum amount of tickets valid at any point in time. This may be a performance issue, when you have A LOT of tickets which are used at random and with uniform distribution - then users may encounter a slightly slower redirection from moodle to Alfresco, as the ticket would have to be loaded from disk in order to be validated.
1000 is usually a high enough number and load performance from disk cache is good enough to be unnoticable for users.
Glad to have been of help…
Regards
Axel
as long as the overflowToDisk property is active and there is no maxElementsOnDisk, the maxElementsInMemory is not a property that can limit the maximum amount of tickets valid at any point in time. This may be a performance issue, when you have A LOT of tickets which are used at random and with uniform distribution - then users may encounter a slightly slower redirection from moodle to Alfresco, as the ticket would have to be loaded from disk in order to be validated.
1000 is usually a high enough number and load performance from disk cache is good enough to be unnoticable for users.
Glad to have been of help…
Regards
Axel

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2011 10:59 AM
Thanks again Axel, that all makes sense.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2012 04:36 AM
Hi….
the above configuration will works if the alfresco is properly restarted. My question is what is the solution if sudden system crash or power failure happens. I am thinking to store tickets in local storage whenever they created…but I am not getting any configuration help for it.
So, Is there any way to store tickets in local storage whenever they created. If yes, is it possible to restore them after system crash.
the above configuration will works if the alfresco is properly restarted. My question is what is the solution if sudden system crash or power failure happens. I am thinking to store tickets in local storage whenever they created…but I am not getting any configuration help for it.
So, Is there any way to store tickets in local storage whenever they created. If yes, is it possible to restore them after system crash.
