In the process of migrating a symfony3.4 project to Symfony4 with symfony-flex …
After adapting the directory structure and proceeding to few adjustments, I now face what looks like a circular dependency error that comes to light during the application service container bootstrapping phase. Hitting the application (whether from the console or the fronted) raises some exception related to Xdebug saying «nested function calls limit reached ('256')».
Looking at the backtrace reveals kind of a pattern that repeats itself and leads to the conclusion that Xdebug is not the one to blame but two services depending indirectly on each-other instead.
Involved services are:
Log manager is a public service which helps persisting user actions to database:
log_manager:
class: Service\Log\LogManager
public: true
arguments:
- "#doctrine.orm.entity_manager"
- "#?security.token_storage"
LoggableSubscriber consumes LogManager service to create a new record when some application objects state change:
Doctrine\Behavior\ORM\Loggable\LoggableSubscriber:
public: false
arguments:
- "#log_manager"
- "#event_dispatcher"
tags:
- { name: doctrine.event_subscriber }
Backtrace (please read from bottom to top):
==== ↑↑ PATTERN REPEATS ON AND ON ↑↑ ====
==== ONCE AGAIN DOCTRINE LOOKS FOR SUBSCRIBERS ====
at boDevDebugProjectContainer->load('…/var/cache/bo/dev/ContainerTv5AUyL/getLoggableSubscriberService.php')
in getDoctrine_Dbal_ApiacmeConnectionService.php (line 34)
at require('…/var/cache/bo/dev/ContainerTv5AUyL/getDoctrine_Dbal_ApiacmeConnectionService.php')
in boDevDebugProjectContainer.php (line 446)
at boDevDebugProjectContainer->load('…/var/cache/bo/dev/ContainerTv5AUyL/getDoctrine_Dbal_ApiacmeConnectionService.php')
in getDoctrine_Orm_ApiacmeEntityManagerService.php (line 74)
at require('…/var/cache/bo/dev/ContainerTv5AUyL/getDoctrine_Orm_ApiacmeEntityManagerService.php')
in boDevDebugProjectContainer.php (line 446)
==== "LOGMANAGER" NATURALLY REQUIRES DOCTRINE ENTITY MANAGER SERVICE ====
at boDevDebugProjectContainer->load('…/var/cache/bo/dev/ContainerTv5AUyL/getDoctrine_Orm_ApiacmeEntityManagerService.php')
in getLogManagerService.php (line 10)
at require('…/var/cache/bo/dev/ContainerTv5AUyL/getLogManagerService.php')
in boDevDebugProjectContainer.php (line 446)
at boDevDebugProjectContainer->load('…/var/cache/bo/dev/ContainerTv5AUyL/getLogManagerService.php')
in getLoggableSubscriberService.php (line 11)
==== BUT OUR "LOGGABLESUBSCRIBER" IN TURN NEEDS THE "LOGMANAGER" SERVICE ====
at require('…/var/cache/bo/dev/ContainerTv5AUyL/getLoggableSubscriberService.php')
in boDevDebugProjectContainer.php (line 446)
==== DOCTRINE LOADS SUBSCRIBERS (ATTACHED VIA "TAG" PROPERTY) ====
at boDevDebugProjectContainer->load('…/var/cache/bo/dev/ContainerTv5AUyL/getLoggableSubscriberService.php')
in getDoctrine_Dbal_ApiacmeConnectionService.php (line 34)
==== ↑↑ PATTERN STARTS HERE ↑↑ ====
at require('…/var/cache/bo/dev/ContainerTv5AUyL/getDoctrine_Dbal_ApiacmeConnectionService.php')
in boDevDebugProjectContainer.php (line 446)
at boDevDebugProjectContainer->load('…/var/cache/bo/dev/ContainerTv5AUyL/getDoctrine_Dbal_ApiacmeConnectionService.php')
in getDoctrine_Orm_ApiacmeEntityManagerService.php (line 74)
at require('…/var/cache/bo/dev/ContainerTv5AUyL/getDoctrine_Orm_ApiacmeEntityManagerService.php')
in boDevDebugProjectContainer.php (line 446)
==== FIRST, OUR "LOGMANAGER" SERVICE DEPENDS ON DOCTRINE MAIN ENTITYMANAGER ====
at boDevDebugProjectContainer->load('…/var/cache/bo/dev/ContainerTv5AUyL/getDoctrine_Orm_ApiacmeEntityManagerService.php')
in getLogManagerService.php (line 10)
at require('…/var/cache/bo/dev/ContainerTv5AUyL/getLogManagerService.php')
in boDevDebugProjectContainer.php (line 446)
↑↑ ↑↑ ↑↑
…
Is this purely a misconception issue ? Or is there a way to make the service container aware of this situation by setting some property/flag somewhere in the configuration so that it doesn't go mad ? I saw several questions related to this topic but answers are specific to their question's context.
I was about to break the LogManager service dependency on doctrine's entity manager, making LogManager class unable to persist its underlying entity object to database by itself anymore and as a consequence delegating that job to the calling context by returning the instance to be persisted instead. I am not convinced this is the ideal solution though.
Suggested approach would really be appreciated.
Thank you.
Replacing dependency injection argument with a method call did fix the issue. My log_manager service definition now looks like this:
log_manager:
class: Service\Log\LogManager
public: true
arguments:
- "#?security.token_storage"
calls:
- ['setEntityManager', ["#doctrine.orm.entity_manager"]]
Please comment/answer if there is a better way to solve the issue.
Related
I've a question regarding capture of "uncaught" exceptions, which appears with stack trace on System.err, circumventing logging configuration: All the other log messages appear properly formatted on System.out (JSON-formatted in my case). But this doesn't happen with Exceptions and stack traces "logged" to System.err!
I've recognized this to happen under at least two circumstances:
Asynchronous execution of tasks (HTTP requests in my case) via ExecutorService (as mentioned in "Scheduled Tasks" chapter). I've added #Retryable annotation to the method; but after all retries fail, "final" Exception thrown by last unsuccessful retry appears on System.err with its stack trace (the other ones thrown by earlier failed retries do not appear, seems they are caught by retry "mechanism" under the hood).
With Exceptions thrown by failed Health indicators (they are implemented by subclassing AbstractHealthIndicator).
I've tried implementing my own TaskExceptionHandler, replacing the default one (also mentioned in "Scheduled Tasks" chapter); and/or by adding System.setErr(System.out) in main method before building/setup of Micronaut Application Context. But nothing seems to help as my test cases attest.
Have I missed a chapter in Micronaut's documentation?
Thanks for any hints.
Regards
Christian
My wager is that Micronaut doesn't provide tools for setting a global uncaught exception handler because that's governed by the wider JRE. We've solved the problem in a few of our services with Thread.html#setDefaultUncaughtExceptionHandler by doing something like this at application startup:
Thread.setDefaultUncaughtExceptionHandler((t, e) -> logger.error("Uncaught exception", e));
It seems catching System.ServiceModel.EndpointNotFoundException doesn't work in orchestrations despite of:
port settings: Delivery Notification = Transmitted (it should work without this in two-way port)
catching exception in specific order
catching Microsoft.XLANGs.BaseTypes.DeliveryFailureException
catching super class exception CommunicationObjectFaultedException like here
scope in scope configuration like here
Orchestration only catches System.Exception. Is that bug or am I missing something?
EDIT :
My configuration:
Sendport WCF-WebHttp
Endpoint REST
I managed to put Microsoft.XLANGs.Core.XlangSoapException catch type by editing odx file in notepad (its hack!)- and This actually works as I want becasue
this type encapsulates System.ServiceModel.EndpointNotFoundException by Biztalk I persume.
This type of exception is thrown in orchesration but VS doesnt let me choose this type of exception I believe that is done in purpose to not to do that.
I am working on a project related to Coordinate Reference Systems (CRS) using geoTools. I am getting 'NoSuchAuthorityCodeException' exception with the above message while executing my jar. Things work fine when using EPSG CRS Authority. Fails when I specify 'AUTO:42001' CRSAuthorityFactory. Is there any Library/plug-in to be used. ?
Below is the Exception
at
org.geotools.referencing.factory.ManyAuthoritiesFactory.noSuchAuthority(ManyAuthoritiesFactory.java:489)
at org.geotools.referencing.factory.ManyAuthoritiesFactory.getAuthorityFactory(ManyAuthoritiesFactory.java:467)
at org.geotools.referencing.factory.ManyAuthoritiesFactory.getCRSAuthorityFactory(ManyAuthoritiesFactory.java:548)
at org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:801)
at org.geotools.referencing.factory.ThreadedAuthorityFactory.createCoordinateReferenceSystem(ThreadedAuthorityFactory.java:731)
at org.geotools.referencing.DefaultAuthorityFactory.createCoordinateReferenceSystem(DefaultAuthorityFactory.java:179)
at org.geotools.referencing.CRS.decode(CRS.java:519)
What does 'segment' and 'progress' mean in that kind of exception
2) xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'MainEventProcess.MainEvent(5b530a24-7336-4695-78ee-1d4ffdd9f210)'.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: cf584087-a9d3-4be7-8da7-eae49fd4a108
Shape name: SendDeviationOut
ShapeId: dc5c3484-7955-4d75-b1f9-7e0ca8ecbc1e
Exception thrown from: segment 4, progress 8
Inner exception: Exception occurred when persisting state to the database.
Full details hereon MSDN:
Exception during execution of Orchestration
Can it be helpful in searching errors in code?
First, it's nothing you need to worry about and is not related to your app/code/implementation.
The two items you need to act on are SendDeviationOut and Exception occurred when persisting state to the database. You are most likely publishing a message and there are no Subscribers. This is the "no Subscribers found" error from the Orchestration engine.
Now, to answer your specific question, those are markers to blocks of C# code that XLang compiler generated from your Orchestration. Basically, every statement is organized into a group, segment, and each is executed and tracked individually, progress. If you open the File0.cs, you will see this in action.
sorry if my english is bad.
I have a problem while calling one of my GWT services.
On the client side, I have the following error.
[ERROR] com.google.gwt.user.client.rpc.StatusCodeException: 500 The call failed on the server; see server log for details
[ERROR] at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:209)
[ERROR] at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
[ERROR] at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
...
Unhappily, I can't find any information related to this error on the server logs.
I'm in devlopment mode, and the only thing I can see in jetty is
[ERROR] 500 - POST /my/maping (127.0.0.1) 57 bytes
However, I know that my service implementation is called and that it returns a result without throwing any exception (because I use logs just before the return...) .
I have seen that this problem could be a serialization issue, but I really don't see where I miss something to make my objects serializables, ( plus, gwt compilator generally says me when something is not serializable).
And my/mapping should be finely defined, because it was working previously, and I am pretty sure that I have not modified anything related to this...
Finally, I don't find any interesting answer to my problem.
If you have any ideas, thanks in advance for your help.
ps: I use gwt 2.5.0-rc2.
This problem is mostly related to a class that forgot to implement the isSerializable or Serializable interface. Also Check if all subclassess in that class also implement isSerializable or Serializable interface.
Then verify that all class have a default no argument constructor.
If you are using JPA and the class relations are setup incorrectly, a general 500 will be thrown without an specific error messages