Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Bundle A depended on Bundle B randomly crashes during clean startup
Bundle A depended on Bundle B randomly crashes during clean startup [message #634772] Sat, 23 October 2010 10:46 Go to next message
Kostas Kougios is currently offline Kostas KougiosFriend
Messages: 42
Registered: August 2010
Member
I've a bundle A which depends on my bundle B. Both live in the pickup directory.

A is called com.rits.derby and B is called com.rits.databases. derby needs databases and it imports it:

...
Import-Library: org.springframework.spring
Import-Bundle: org.apache.commons.dbcp
 ,derbyclient
 ,com.rits.databases
Import-Package: org.slf4j
Export-Package: com.rits.derby


If I delete all files under virgo/work and start the server, I get :

Caused by: org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'com.rits.derby' at version '1.0.0': Import-Bundle with symbolic name 'com.rits.databases' in version range '[0.0.0, oo)' could not be satisfied
	at org.eclipse.virgo.kernel.userregion.internal.importexpansion.ImportExpansionHandler.getBundlePackageImports(ImportExpansionHandler.java:271)
	at org.eclipse.virgo.kernel.userregion.internal.importexpansion.ImportExpansionHandler.getAdditionalPackageImports(ImportExpansionHandler.java:236)
	at org.eclipse.virgo.kernel.userregion.internal.importexpansion.ImportExpansionHandler.expandImports(ImportExpansionHandler.java:206)
	at org.eclipse.virgo.kernel.userregion.internal.importexpansion.ImportExpansionHandler.expandImportsIfNecessary(ImportExpansionHandler.java:174)
	at org.eclipse.virgo.kernel.userregion.internal.importexpansion.ImportExpansionHandler.expandImports(ImportExpansionHandler.java:112)


But if I "touch" derby bundle it loads just fine.

Any ideas would be appreciated.

Thanks
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #634778 is a reply to message #634772] Sat, 23 October 2010 13:12 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
Can you attach bundles? Are you deleting work in a running server?

[Updated on: Sat, 23 October 2010 13:15]

Report message to a moderator

Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #634801 is a reply to message #634772] Sat, 23 October 2010 16:45 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
The order of installation of bundles in the pickup directory is not defined, so when they install in the "wrong" order you see the error.

The only ordering guarantee we make is that if you carefully drop artifacts in the pickup directory in the "right" order, allowing each to deploy before dropping the next, Virgo respects the order when it warm starts. However, on a cold start it is as if all the files in the pickup directory were placed there at once and the deployment order is no longer guaranteed.

There are better ways of providing dependencies.

You could place both bundles in repository/usr and then deploy a plan in pickup which refers to both bundles. The plan defines the order of install, but plan contents are installed before being started, so the order isn't crucial for simple package dependencies. (The start order might be significant though and again this is in the order the artifacts are specified in the plan.)

You could package the bundles in a PAR file so that they are both installed before being started and then deploy the PAR file in pickup.

Or you could put bundle B in repository/usr and deploy bundle A to pickup. Virgo will "fault in" bundle B while calculating the dependencies of bundle A.

Hope that helps.
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #634892 is a reply to message #634801] Sun, 24 October 2010 23:06 Go to previous messageGo to next message
Kostas Kougios is currently offline Kostas KougiosFriend
Messages: 42
Registered: August 2010
Member
Dmitry, I've uploaded both bundles but ofcourse dependencies are missing.

I am stopping the server, then cleaning work directory and then starting the server.

Btw, once more I have a spring annotations issue and posted it in an other thread: http://www.eclipse.org/forums/index.php?t=msg&th=199015& amp;start=0&S=21ba2fa524af0c00e317f23d78d6f545 .

Glyn, I suppose if the bundles are under usr directory, then they won't be reloaded automatically. And since I am developing those bundles, I want them to reload on every change I make, hence I placed them under pickup directory.

I need to try a plan with the plan+bundles under the pickup.

I think a way for all the bundle/clean issues to go away would be if virgo was re-scanning the repositories once (and updating it's cache) before throwing UnableToSatisfyBundleDependenciesException
  • Attachment: pickup.zip
    (Size: 5.10KB, Downloaded 292 times)
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #634942 is a reply to message #634892] Mon, 25 October 2010 08:04 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
If you want to reload either bundle as soon as you change it, I would recommend changing the interface between the bundles to be a service dependency with the service interface package stored in some other (relatively stable) bundle. Then the order of deployment won't matter. (This should also help unit testing as you can mock or stub the service interface.)
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #635206 is a reply to message #634892] Tue, 26 October 2010 00:43 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
Without looking too deep into it. (Sorry).

Have you tried this:
1. Remove all your bundles from pickup
2. Restart server -clean
3. Copy com.rits.databases to pickup.
3.1 Any issues?
4. Copy com.rits.derby to pickup
4.1 Any issues?

Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #635460 is a reply to message #634942] Tue, 26 October 2010 22:03 Go to previous messageGo to next message
Kostas Kougios is currently offline Kostas KougiosFriend
Messages: 42
Registered: August 2010
Member
Glyn Normington wrote on Mon, 25 October 2010 04:04
If you want to reload either bundle as soon as you change it, I would recommend changing the interface between the bundles to be a service dependency with the service interface package stored in some other (relatively stable) bundle. Then the order of deployment won't matter. (This should also help unit testing as you can mock or stub the service interface.)


Hi Glyn, that would require more work per service, especially for interfaces that will have 1 and only 1 impl. Also changing the interface means restarting the server.

I would like to find a simple way to make it work without compromise...
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #635461 is a reply to message #635206] Tue, 26 October 2010 22:14 Go to previous messageGo to next message
Kostas Kougios is currently offline Kostas KougiosFriend
Messages: 42
Registered: August 2010
Member
Dmitry Sklyut wrote on Mon, 25 October 2010 20:43
Without looking too deep into it. (Sorry).

Have you tried this:
1. Remove all your bundles from pickup
2. Restart server -clean
3. Copy com.rits.databases to pickup.
3.1 Any issues?
4. Copy com.rits.derby to pickup
4.1 Any issues?




this works and though it is ok for deploying the bundles, it is too much work to do during development.

I've configured my eclipse to build the bundle's jar/war whenever I change a single file. That is convenient and works nicely and allows me to quickly change and test my code. It only works via the pickup dir though.

Also if I do a clean-build, the virgo/work directory is cleaned up which is equivalent to -clean (I think....) .

That means that all jars/wars are available after a -clean restart of virgo. I've checked he docs and virgo won't pick bundles of a plan file from the pickup => I am stuck cause I can't order the way they are loaded.

A question is why virgo doesn't "index" the bundles of the pickup directory before actually loading them? This way it would know that the required B bundle is available when trying to start A.
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #635485 is a reply to message #635461] Wed, 27 October 2010 03:34 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Kostas Kougios wrote on Tue, 26 October 2010 23:14
A question is why virgo doesn't "index" the bundles of the pickup directory before actually loading them? This way it would know that the required B bundle is available when trying to start A.


We seriously considered this option a couple of years ago but were put off by the complexity and potential unreliability. The main problem is that some file systems (e.g. on Windows) are not very helpful and it is quite hard to determine when a file has "stabilised" and is ready for deployment. Encouraging users to drop related groups of bundles into pickup would make this problem quite a lot harder. How would we know when the group was complete so we could index it?

Also, this indexing is far from straightforward as we cannot really tell bundle dependencies until we drive the OSGi resolver. What we would actually need to do is spot a group and make sure they are deployed together.

We are considering an extension to plans which may help solve this problem: allowing a plan to refer to artifacts by URI. This would allow the artifacts to be updated more easily as they would not need to be in a repository.

See bug 327538 for more information (including the bugs it blocks, which are the enhancements we currently see - please feel free to raise another to cover your use case).
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #635733 is a reply to message #635485] Wed, 27 October 2010 21:32 Go to previous messageGo to next message
Kostas Kougios is currently offline Kostas KougiosFriend
Messages: 42
Registered: August 2010
Member
Glyn Normington wrote on Tue, 26 October 2010 23:34
Kostas Kougios wrote on Tue, 26 October 2010 23:14
A question is why virgo doesn't "index" the bundles of the pickup directory before actually loading them? This way it would know that the required B bundle is available when trying to start A.


We seriously considered this option a couple of years ago but were put off by the complexity and potential unreliability. The main problem is that some file systems (e.g. on Windows) are not very helpful and it is quite hard to determine when a file has "stabilised" and is ready for deployment. Encouraging users to drop related groups of bundles into pickup would make this problem quite a lot harder. How would we know when the group was complete so we could index it?

Also, this indexing is far from straightforward as we cannot really tell bundle dependencies until we drive the OSGi resolver. What we would actually need to do is spot a group and make sure they are deployed together.

We are considering an extension to plans which may help solve this problem: allowing a plan to refer to artifacts by URI. This would allow the artifacts to be updated more easily as they would not need to be in a repository.

See bug 327538 for more information (including the bugs it blocks, which are the enhancements we currently see - please feel free to raise another to cover your use case).



ok, sounds like a solution. How will it work? I.e. if a plan is "touch"ed will virgo check for modification to all URI's?
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #635769 is a reply to message #635733] Thu, 28 October 2010 03:40 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
We'll probably offer operations via JMX, which can ultimately be driven by the development tooling, to either refresh the whole plan or to refresh a specific artifact of a plan, although I am yet to work out the details.

If you raise an enhancement bug to cover your use case, you can capture specific requirements there for posterity.
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #635965 is a reply to message #635769] Thu, 28 October 2010 18:47 Go to previous messageGo to next message
Kostas Kougios is currently offline Kostas KougiosFriend
Messages: 42
Registered: August 2010
Member
Glyn Normington wrote on Wed, 27 October 2010 23:40
We'll probably offer operations via JMX, which can ultimately be driven by the development tooling, to either refresh the whole plan or to refresh a specific artifact of a plan, although I am yet to work out the details.

If you raise an enhancement bug to cover your use case, you can capture specific requirements there for posterity.


Hi, no I am happy with the JMX solution it is more proper than probing for a changed file in the filesystem every sec.

When do you think this will be ready?

Thanks
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #636523 is a reply to message #635965] Mon, 01 November 2010 17:02 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
I was suggesting that you raise an enhancement bug to capture your requirement. Unfortunately, it is hard to say when we will satisfy particular requirements until we have done more planning. We will be holding a Virgo F2F around the end of this month, so please would you raise your requirement by then so we can take it into account.
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #637044 is a reply to message #636523] Wed, 03 November 2010 22:29 Go to previous messageGo to next message
Kostas Kougios is currently offline Kostas KougiosFriend
Messages: 42
Registered: August 2010
Member
Glyn Normington wrote on Mon, 01 November 2010 13:02
I was suggesting that you raise an enhancement bug to capture your requirement. Unfortunately, it is hard to say when we will satisfy particular requirements until we have done more planning. We will be holding a Virgo F2F around the end of this month, so please would you raise your requirement by then so we can take it into account.


Hi, I am happy to go for the JMX solution, it's just what I need. I was just wondering when abouts it will be ready.

Are you suggesting I raise an enhancement bug for the JMX?

Thanks

Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #637071 is a reply to message #637044] Thu, 04 November 2010 04:07 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Kostas Kougios wrote on Wed, 03 November 2010 22:29
Are you suggesting I raise an enhancement bug for the JMX?



Yes, that's right.
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #637284 is a reply to message #637071] Thu, 04 November 2010 20:18 Go to previous messageGo to next message
Kostas Kougios is currently offline Kostas KougiosFriend
Messages: 42
Registered: August 2010
Member
Glyn Normington wrote on Thu, 04 November 2010 00:07
Kostas Kougios wrote on Wed, 03 November 2010 22:29
Are you suggesting I raise an enhancement bug for the JMX?



Yes, that's right.



Ok, here it is: https://bugs.eclipse.org/bugs/show_bug.cgi?id=329487

Cheers
Re: Bundle A depended on Bundle B randomly crashes during clean startup [message #637353 is a reply to message #637284] Fri, 05 November 2010 08:10 Go to previous message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
Thanks Kostas.
Previous Topic:Virgo Fails to Start On alternate Invocation
Next Topic:HttpServletRequest.getRealPath() broken in Virgo?
Goto Forum:
  


Current Time: Fri Apr 19 22:08:51 GMT 2024

Powered by FUDForum. Page generated in 0.03374 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top