Closed LiHaoGit closed 7 years ago
I have the same problem running on Windows 7
I'm on MacOS X now so I don't have Windows issues anymore ;-) I guess you already tried to clean the Temp
directory before starting the webapp?
I have cleaned manually, restart the windows and the problem still persist. For while I have decided move back to the 4.1.8 CAS version (working on windows 7) because the version 5 seems not fully mature. Hopefully I can integrate with pac4j and spring-boot (next steps).
I have successfully used the version 5 a couple of times (on MacOS X though). Did you report this problem on the CAS mailing list? @mmoayyed Have you ever heard about this problem on Windows?
I tested with Mac and Linux is working fine, the problem is specific with windows when the Management starts try to delete the service files (json) and the files is still being used. I believe those files is still opened by the cas webapp. The same problem happen even with the 5.0.4 version (supposedly stable)
Reading: https://github.com/apereo/cas/blob/5.0.x/core/cas-server-core-services/src/main/java/org/apereo/cas/services/AbstractResourceBasedServiceRegistryDao.java, I don't see anything which could explain your specific issue. I guess it's only because of Windows.
I found what is going on already, but I believe the people from CAS should change the approach to register the services.
Differently of *nix systems, the Windows lock a file when it is opened (even just for read). It seems there is one or more scheduled tasks reloading the directory "${java.io.tmpdir}/cas/services". I believe is a good idea to use a explicit lock file (opened for loading) in the temp directory and if the lock file exists do not try to delete because it's being used.
To verify that it was happening, first I executed the server and management using different temp directory
java -jar -Djava.io.tmpdir=c:\temp\cas cas-overlay-server-demo\target\cas.war
java -jar -Djava.io.tmpdir=c:\temp\mgr cas-overlay-management-demo\target\cas-management.war
And the errors was became less frequent (loading almost always with success the cas server).
To prove that has an process scheduled I made a couple changes: Created new classes under cas-overlay-server-demo using System.out.println to show when the file is being loaded. cas-overlay-server-demo.zip
After to see this, I believe the version 5.0.4 is still not tested on Windows systems.
I guess the best way to solve this problem is to create my own class implementing the ServiceRegistryDao
interface. With this approach I can implement in a way that if the file is being used (lock files for example) don't try to delete it. What do you think?
With this approach I can implement in a way that if the file is being used (lock files for example) don't try to delete it. What do you think?
No, that's a very very bad idea.
There is an inordinate amount of literature on the CAS docs asking you to stop writing code. What you're describing sounds like an issue with the project; not something you need to fix for you on your own. There is no such thing as the people from CAS. YOU are the people from CAS. YOU are part of the project as you soon as you start deploying the software. The responsibility is shared; not passed off to a bunch of other folks to fix issues for you. Work on the issue, provide a pull request/patch and solve the problem where it belongs once. Or, you'd be setting yourself up for a lot of surprises and disappointments.
Thanks @mmoayyed for your feedback, I would like to contribute with the CAS project, I thought Aspereo was a company and owner of the product. Maybe because I don't have much experience working on open source projects. I don't have much intimacy with the CAS internals, so I'm going to report this problem in the forum and contribute as much as I can to solve this problem. Done!
Thanks very much! and excellent work. I would be more than glad to guide you along the internals as much as possible. Lets carry on the conversation on the list and aim towards your first contribution and patch, which is absolutely more than welcome any day and time :)