I have a spring application configured with SAML for authentication.
It uses logback for logging. The logging happens only for a day or so, after which it stops automatically with the following msg in the log:
[LOG] [org.apache.commons.logging.impl.Jdk14Logger:log:87] - Closing WebApplicationContext for namespace 'dispatcherServlet-servlet': startup date [Wed Jun 22 04:50:14 UTC 2016]; parent: Root WebApplicationContext
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.springframework.security.saml.util.SAMLUtil:marshallMessage:390] - XMLObject already had cached DOM, returning that element
[LOG] [org.apache.commons.logging.impl.Jdk14Logger:log:87] - ClosingRoot WebApplicationContext: startup date [Wed Jun 22 04:50:00 UTC 2016]; root of context hierarchy
[LOG] [org.springframework.security.saml.metadata.ExtendedMetadataDelegate:destroy:178] - Destroying delegate
[LOG] [org.springframework.security.saml.metadata.ExtendedMetadataDelegate:destroy:178] - Destroying delegate
[LOG] [org.springframework.security.saml.metadata.ExtendedMetadataDelegate:destroy:178] - Destroying delegate
I have to restart tomcat in order to resume logging. Every time, the logging stops with the above messages only. So, I suspect something with the SAML integration.
Any pointers on how to fix this issue is highly appreciated.
This was not an issue with the Spring or Spring SAML at all.
I had used a relative file path in the logback configuration.
Looks like the log rotation doesn't work properly with relative file path.
Using an absolute file path solved the issue.
Related
We have a custom module that receives messages from a Modbus Module but recently the messages started to not be delivered to the destination.
It was working fine until few days ago.
Looking at the edgeHub's log it apparently initializes correctly and then appears the following WARNINGS
<4> 2020-09-23 03:06:30.309 +00:00 [WRN] - Did not receive ack for message 8eba78ae-65f3-426f-97e6-d53681c99ab8 from device/module DEVICE_ID/MODULE_NAME
<4> 2020-09-23 03:06:30.342 +00:00 [WRN] - Error sending messages to module DEVICE_ID/MODULE_NAME
System.TimeoutException: Message completion response not received
at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 428
at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.ProcessAsync(ICollection`1 routingMessages, IDeviceProxy dp, CancellationToken token) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 166
<4> 2020-09-23 03:07:01.766 +00:00 [WRN] - Did not receive ack for message fbb1e347-d290-4527-9558-127f2d8f357d from device/module DEVICE_ID/MODULE_NAME
The Custom Module gets stuck in the first very message received from Modbus, and get it repeatedly.
However It does not impact it in receiving Command from the Cloud.
Our version of iotedge is 1.0.9.5 and the Microsoft.Azure.Devices.Client version is 1.25.0.
Poltergeist is unable to connect to the server. Here's the error I'm getting:
Failure/Error: visit root_path
Capybara::Poltergeist::StatusFailError:
Request to 'http://127.0.0.1:58638/' failed to reach server, check DNS and/or server status
I've got the phantomjs debug output on, and here's what looks like the relevant lines to me:
2016-12-14T14:24:47 [DEBUG] WebpageCallbacks - getJsConfirmCallback
{"command_id":"5eab3091-26bd-47b7-b779-95ec9523fb5b","response":true}
{"id":"1069af41-1b7c-4f5b-a9c7-258185aa8c73","name":"visit","args":["http://127.0.0.1:58638/"]}
2016-12-14T14:24:47 [DEBUG] WebPage - updateLoadingProgress: 10
2016-12-14T14:24:48 [DEBUG] Network - Resource request error: QNetworkReply::NetworkError(ConnectionRefusedError) ( "Connection refused" ) URL: "https://127.0.0.1/"
2016-12-14T14:24:48 [DEBUG] WebPage - updateLoadingProgress: 100
2016-12-14T14:24:48 [DEBUG] WebPage - setupFrame ""
2016-12-14T14:24:48 [DEBUG] WebPage - setupFrame ""
2016-12-14T14:24:48 [DEBUG] WebPage - evaluateJavaScript "(function() { return (function () {\n return typeof __poltergeist;\n })(); })()"
2016-12-14T14:24:48 [DEBUG] WebPage - evaluateJavaScript result QVariant(QString, "undefined")
{"command_id":"1069af41-1b7c-4f5b-a9c7-258185aa8c73","error":{"name":"Poltergeist.StatusFailError","args":["http://127.0.0.1:58638/",null]}}
{"id":"cbe42cdc-58db-49c5-a230-4a1f4634d830","name":"reset","args":[]}
This bit seemed like a clue Network - Resource request error: QNetworkReply::NetworkError(ConnectionRefusedError) ( "Connection refused" ) URL: "https://127.0.0.1/" and that it could be an ssl error, so I added the phantomjs option --ignore-ssl-errors=true, but it makes no difference to the response.
I switched over to capybara-webkit to see if that would provide a bit more info as some people have recommended. I get a very similar error:
"Visit(http://127.0.0.1:64341/)" started page load
Started request to "http://127.0.0.1:64341/"
Finished "Visit(http://127.0.0.1:64341/)" with response "Success()"
Started request to "https://127.0.0.1/"
Received 301 from "http://127.0.0.1:64341/"
Received 0 from "https://127.0.0.1/"
Page finished with false
Load finished
Page load from command finished
Wrote response false "{"class":"InvalidResponseError","message":"Unable to load URL: http://127.0.0.1:64341/ because of error loading https://127.0.0.1/: Unknown error"}"
Received "Reset()"
Started "Reset()"
undefined|0|SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy of the user agent.
With the help of #thomas-walpole I realised that if I specific a non-https url to visit in capybara, it works. E.g visit "http://localhost:3000" it works. Using visit root_url works, but using visit root_path I get directed to https and the error above.
config.force_ssl is not true. I've set config.force_ssl = false in config/environments/test.rb and also used pry to check the Application.config in the context of the test.
Any ideas for why the path helpers are getting sent over https would be greatly appreciated.
Your app is redirecting the request to https, but Capybara doesn't run the app with https support. If it's a rails app you've probably got the config.force_ssl option enabled in your app - set it to false in the test environment. If that doesn't fix it then you'll have to look through your app to see why it's redirecting and turn off that behavior in test mode.
I am using orbeon xform engine as a separate deployment with my Java Application. I followed all the steps required for separate deployment but while implementing xfroms using Orbeon I am getting following error:
"Orbeon Forms - Unauthorized
You do not have access to this page."
Inside tomcat orbeon log file it is showing following error:
392 INFO ProcessorService - Context listener - Context initialized.
522 INFO ProcessorService - Servlet initialized.
724 INFO ProcessorService - /xforms-renderer - Received request
192 INFO PageFlowControllerProcessor - unauthorized {controller: "oxf:/ops/xforms/xforms-renderer-page-flow.xml", method: "POST", path: "/xforms-renderer", status-code: "403"}
205 INFO ProcessorService - /xforms-renderer - Timing: 2465
I used RequestDispatcher in my servlet to forward my request for required XForm
ServletContext context= getServletContext();
RequestDispatcher rd= context.getRequestDispatcher("/xforms-jsp/orbeon/form.jsp");
rd.forward(request, response);
I am able to render xfrom while implementing as a integrated deployment.
May you guide where I am getting wrong.
Thanks!
If you're using separate deployment, you should be using the Orbeon servlet filter in your web.xml, and you don't need to use a RequestDispatcher in your own code. I double-checked this now with 4.0 to verify it works. (I am wondering what led you to believe that you needed to use your own RequestDispatcher, as I don't see anything about this in the separate deployment documentation.)
Note however that because of this issue, for now you also need to add the orbeon class on the <body> of your HTML, otherwise the proper styles won't apply. This is just temporary, and the class will be added automatically for you when this issue is fixed.
So I have an application that earlier did not need ActiveRecord - thus we removed ActiveRecord from the application and formatted our logging as such:
In application.rb:
class DreamLogFormatter < Logger::Formatter
SEVERITY_TO_COLOR_MAP = {'DEBUG'=>'32', 'INFO'=>'0;37', 'WARN'=>'35', 'ERROR'=>'31', 'FATAL'=>'31', 'UNKNOWN'=>'37'}
def call(severity, time, progname, msg)
color = SEVERITY_TO_COLOR_MAP[severity]
"\033[0;37m[%s] \033[#{color}m%5s - %s\033[0m\n" % [time.to_s(:short), severity, msg2str(msg)]
end
end
class ActiveSupport::BufferedLogger
def formatter=(formatter)
#log.formatter = formatter
end
end
In development.rb
config.logger = Logger.new("log/#{Rails.env}.log")
config.logger.formatter = DreamLogFormatter.new
ActiveResource::Base.logger = Logger.new("log/#{Rails.env}.log")
ActiveResource::Base.logger.formatter = DreamLogFormatter.new
Note: The ActiveResource logger configuration was added because we want the URL output of our ActiveResource calls like so:
GET http://localhost:2524/users/
--> 200 OK 239 (13.0ms)
Logging with this configuration gave us a nice output combination of ActiveResource calls and our own logging using Rails.logger.
However, we have needed to add ActiveRecord back into our application as we needed to change our session storage from cookie store to ActiveRecord store. And since adding ActiveRecord back in, the logging is no longer working nicely.
Previous Log Output:
Started GET "/audit/?key1=value1&key2=value2" for 0:0:0:0:0:0:0:1%0 at 2012-08-15 15:39:58 -0400
[15 Aug 15:39] INFO - Processing by AuditController#index as HTML
[15 Aug 15:39] INFO - Parameters: {"utf8"=>"✓", "key1"=>"value1", "key2"=>"value2"}
[15 Aug 15:39] INFO - GET http://localhost:2524/api/users/jeff/prefs/?label=language
[15 Aug 15:39] INFO - --> 200 OK 151 (55.0ms)
[15 Aug 15:39] WARN - There is no user currently logged in - retrieving default theme.
[15 Aug 15:39] INFO - GET http://localhost:2524/api/users/jeff/prefs/?label=theme
[15 Aug 15:39] INFO - --> 200 OK 151 (35.0ms)
Note: What I really enjoy about this format is each request is logged beginning with a Started GET <URL> or POST or PUT, etc - followed by which controller and function is doing the processing and what the parameters sent are. This is extremely helpful for debugging. As well, this format allowed us to print out our own Rails.logger logging information.
Current Log Output (With ActiveRecord):
[20 Aug 11:40] INFO - GET http://localhost:2524/api/users/jeff
[20 Aug 11:40] INFO - --> 200 OK 199 (144.0ms)
[20 Aug 11:40] INFO - GET http://localhost:2524/api/users/jeff/prefs/?label=language
[20 Aug 11:40] INFO - --> 200 OK 148 (12.0ms)
[20 Aug 11:40] INFO - GET http://localhost:2524/api/users/jeff/prefs/?label=theme
[20 Aug 11:40] INFO - --> 200 OK 155 (15.0ms)
Essentially all we get now is a constant stream of URL calls - it doesn't log anything coming from Rails.logger and also there is no separation between different requests - it is literally just one constant stream of URL's and responses.
I have tried setting ActiveResource::Base.logger = ActiveRecord::Base.logger as a lot of the blogs recommend but that just made things worse - it logged a couple URLs, and then just stopped logging completely unless it was at ERROR level (and nowhere do I set the logging level, so it should still be at default)
Any help or suggestions would be greatly appreciated!! Thanks
Maybe the implementation of lograge will help:
https://github.com/roidrage/lograge/blob/master/lib/lograge.rb#L57
I'm sending an objectManager postObject call through RestKit. After 4 attempts that return 403's my 5th attempt isn't picked up and sent out by RestKit. I've verified this using Charles to watch my actual traffic, and by reviewing the RestKit logs, RestKit is getting my request and putting it in the RequestQueue, but it's never taken back out.
My first 4 requests look like this in the RestKit logs (apologies for the wall of log):
D restkit:RKObjectManager.m:171 CacheTimeoutSet: 60.000000 - 60.000000
T restkit.network.queue:RKRequestQueue.m:226 Request <RKObjectLoader: 0x784ac90> added to queue <RKRequestQueue: 0x6501530>
T restkit.network.queue:RKRequestQueue.m:173 Processing request <RKObjectLoader: 0x784ac90> in queue <RKRequestQueue: 0x6501530>
T restkit.network.queue:RKRequestQueue.m:104 Loading count increasing from 0 to 1. Firing requestQueueDidBeginLoading
T restkit.network.queue:RKRequestQueue.m:131 Loading count set to 1 for queue <RKRequestQueue: 0x6501530>
T restkit.network.cache:RKRequestCache.m:106 Found cachePath '<REMOVED>' for <RKObjectLoader: 0x784ac90>
T restkit.network.cache:RKRequestCache.m:123 Determined hasResponseForRequest: <RKObjectLoader: 0x784ac90> => NO
D restkit.network:RKRequest.m:255 Sending asynchronous POST request to URL <REMOVED>.
D restkit.network:RKObjectLoader.m:295 POST or PUT request for source object <TSLAuthenticationContract: 0x7849b30>
Username:<REMOVED>
Campus:<REMOVED>, serializing to MIME Type application/json for transport...
D restkit.object_mapping:RKObjectMappingOperation.m:391 Starting mapping operation...
T restkit.object_mapping:RKObjectMappingOperation.m:231 Mapping attribute value keyPath 'username' to 'Username'
T restkit.object_mapping:RKObjectMappingOperation.m:241 Mapped attribute value from keyPath 'username' to 'Username'. Value: <REMOVED>
T restkit.object_mapping:RKObjectMappingOperation.m:231 Mapping attribute value keyPath 'password' to 'Password'
T restkit.object_mapping:RKObjectMappingOperation.m:241 Mapped attribute value from keyPath 'password' to 'Password'. Value: <REMOVED>
T restkit.object_mapping:RKObjectMappingOperation.m:231 Mapping attribute value keyPath 'campusName' to 'CampusName'
T restkit.object_mapping:RKObjectMappingOperation.m:241 Mapped attribute value from keyPath 'campusName' to 'CampusName'. Value: <REMOVED>
D restkit.object_mapping:RKObjectMappingOperation.m:397 Finished mapping operation successfully...
T restkit.network.cache:RKRequestCache.m:106 Found cachePath '<REMOVED>' for <RKObjectLoader: 0x784ac90>
D restkit.network.cache:RKRequestCache.m:220 Read nil cached headers from cachePath '<REMOVED>' for '<RKObjectLoader: 0x784ac90>'
D restkit.network.cache:RKRequestCache.m:245 Found cached ETag '(null)' for '<RKObjectLoader: 0x784ac90>'
T restkit.network:RKRequest.m:209 Prepared POST URLRequest '<NSMutableURLRequest <REMOVED>>'. HTTP Headers: <REMOVED>.
D restkit.network.queue:RKRequestQueue.m:180 Sent request <RKObjectLoader: 0x784ac90> from queue <RKRequestQueue: 0x6501530>. Loading count = 1 of 4
T restkit.network.queue:RKRequestQueue.m:142 Timer initialized with delay 0.300000 for queue <RKRequestQueue: 0x6501530>
<REMOVED - Multiple Timer messages>
T restkit.network.queue:RKRequestQueue.m:142 Timer initialized with delay 0.300000 for queue <RKRequestQueue: 0x6501530>
D restkit.network:RKResponse.m:105 NSHTTPURLResponse Status Code: 403
However, on my 5th call this happens:
D restkit:RKObjectManager.m:171 CacheTimeoutSet: 60.000000 - 60.000000
T restkit.network.queue:RKRequestQueue.m:226 Request <RKObjectLoader: 0x782a370> added to queue <RKRequestQueue: 0x6501530>
T restkit.network.queue:RKRequestQueue.m:142 Timer initialized with delay 0.300000 for queue <RKRequestQueue: 0x6501530>
<REMOVED - Multiple Timer messages>
T restkit.network.queue:RKRequestQueue.m:142 Timer initialized with delay 0.300000 for queue <RKRequestQueue: 0x6501530>
As you can see, no Processing request log, no Loading count log, nothing after adding the request to the queue. Has anyone experienced this before? Is there some internal counter that is preventing RestKit from making this call again? I have users that aren't very technical and have issues with there passwords and so it's not inconceivable that they could fail to authenticate more than 4 times in a row.
EDIT:
After more research it appears that RestKit isn't decrementing the loadingCount flag in the objectLoader when it gets a failed response. Unfortunately I'm not sure how I should go about fixing this. Is it as simple as checking for the 403 in my delegate and removing the request manually if I find it?
EDIT 2:
Ok, I was able to force the removal of the failed request by calling RKRequestQueue cancelRequest: in my objectLoader:didFailWithError: delegate method. Not sure if this is the correct way, but it works. I would expect that RestKit internally handled this issue.
Thanks,
Rob
happend to me also
I noticed i got bad exec , so i run the Xcode Profiling and i noticed i was releasing the object running the request to early
after retaining it properly it was solved
I put my solution in edits to my question, but to make SO happy here it is again in an accepted answer.
After more research it appears that RestKit isn't decrementing the
loadingCount flag in the objectLoader when it gets a failed response.
Unfortunately I'm not sure how I should go about fixing this. Is it as
simple as checking for the 403 in my delegate and removing the request
manually if I find it?
Ok, I was able to force the removal of the failed request by
calling RKRequestQueue cancelRequest: in my
objectLoader:didFailWithError: delegate method. Not sure if this is
the correct way, but it works. I would expect that RestKit internally
handled this issue.