AVFramework session issue - ios

When i try to capture video by using AVFramework i receive an exception -11803, which says that the session is not started, the first time when i init session it works fine, but after when controller changes and then again return to the same controller it throws an exception, but in same session image capture works fine.

problem solved,the issue was that the session object was not deallocated properly.

Related

QuickFIX/J session API logon() call failed

Right now we are storing the session in map. So very first time , when we create session, it is possible that the session got created ,but due to some issue ,it immediately disconnected and logged out.
After some time, being the sessionId present in map, we are calling just lookup for that session and call logOn() . It should call my overridden logon() method which is not happening. Can anyone tell me the the possible clause and how to handle this ?when I see the logs, it's showing EndOfStream occurred,disconnecting.

WKWebView WKWebsiteDataStore getAllCookies Doesn't Return the Session Cookie

I just moved our login page from UIWebView to WKWebView and having trouble getting the logged in session cookie.
The method I use is WKWebsiteDataStore getAllCookies but usually it returns no cookies at all or an old cookie, preventing the user from getting the logged in cookie. That way the user cannot login to our app.
I want to mention that sometimes it works fine and I get the login session cookie successfully but usually it doesn't work.
Would appreciate any help to fix this annoying issue.
After a week struggling, I found a way to make it works. Posting here in case anyone need.
#1 Have an instance of processPool and wesiteDataStore.nonpersistent() (make them a global variables if you want to get the Cookies outside of webview didFinish navigation of the same wkWebview)
#2 Create an instance of wkWebviewconfigure with these two:
var wkWebviewconfigure: WKWebViewConfiguration = WKWebViewConfiguration()
wkWebviewconfigure.processPool = myProcessPool
wkWebviewconfigure.websiteDatastore = myWebsiteDatastore // <--- have to be nonpersistent type
#3 Generate webview from code with this wkWebviewconfigure, assigning wkWebviewconfigure to your wkWebview.configuration from .xib and storyboard will not work

Storing instance of a Class in a Rails session causes TypeError exception

In our Rails application we want to store an instance of a class in a session. This is because we want to set the class with some parameters when the user first logs into the application and then re-use this class by pulling it back out of the same session. When their session expires or they log out, this instance of the class is destroyed.
We're doing this to avoid using a Singleton class because that would live at Application-level and be available on different processes and stick around longer than the user's session, and have security implications due to it also being available to other users who haven't created a session yet.
So this is how it works:
session[:example_class] = ExampleClass.new(field_one: 'field_one', field_two: 'field_two')
This works fine!
However if I then do this:
current_instance = session[:example_class]
current_instance.do_something
session[:example_class] = current_instance
Whereby I am calling a method on this instance or whatever and then want to push that updated instance back into the session again so it's stored somewhere... we get this error:
TypeError in HomeController#index
ExampleClass can't be referred to from /Users/cameron/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/bundler/gems/activerecord-session_store-376ed7f7aba1/lib/active_record/session_store.rb:64:in `dump'
And that method that is failing in session_store.rb is:
def self.dump(value)
::Base64.encode64(Marshal.dump(value))
end
And the value it's trying to store is:
{"_csrf_token"=>"nrw4m2ZAECwD3TiaPZoaSt4vL1DvjO+COnBpUQGwpXs=", "example_class"=>#<ExampleClass:0x00007f7fa7b1b998 #field_one="field_one", #field_two="field_two">}
Why can I write the class in the first time around... but afterwards it throws that error?
And how we get around this?
I can't answer you fully why it fails, but I wouln't rely on implicit serialization of Ruby objects.
I would find a way to serialize the object of ExampleClass explicitly (similar to as_json) - convert to a hash, then store the hash in the session. When you need this object again, initialize ExampleClass instance with the params from session and then serialize it back to session.
I don't have an answer for why the above error happened but it turns out if you're storing an instance of a class inside the session, you're in fact storing the instance and not just the current state of the class as I originally thought it was doing.
This basically means that whenever you interact with that class and change it's attributes the session is still reading from the same instance you are interacting with and therefore has the same information without having to write back into the session.
In short you have the behaviour of a Singleton class but using a session to maintain state.

Handle ViewExpiredException before handle() method in ExceptionHandlerWrapper is called

I've already searched via google and on stackoverflow, but could not find any similar problem to mine.
In my project I'm handling a ViewExpiredException properly and show a custom page to the user that the current session has timed out. This works great, but I want to do something BEFORE this message gets shown to the user. Actually I'm working with 2 different sessions here, one on the frontend side and one on the backend, so the idea is to NOT start a new backend session when the current one timed out.
Is there any possibility to fetch the ViewExpiredException while I'm inside the doFilter method, so I do not start a new backend session (simply because it is not needed)? Or is there any other way?
I already tried to fetch the current context via
FacesContext fc = FacesContext.getCurrentInstance();
But obviously the context is null, because the session timed out.
Inside the ExceptionHandlerWrapper I have access to the UnhandledExceptionQueuedEvents, but this does not help me here since I need this information earlier.
I hope I made my problem clear enough.
Thanks in advance for any help!
Regards
Sebastian
Generally ViewExpiredException is thrown when a POST request is fired while the session is timed out. So, this should do in the filter:
boolean post = "POST".equals(request.getMethod());
boolean timedout = request.getRequestedSessionId() != null && !request.isRequestedSessionIdValid();
if (post && timedout) {
// JSF will guaranteed throw ViewExpiredException when state saving is set to server.
}
But this does not cover all possible cases. ViewExpiredException can also occur when the session hasn't timed out. For example, when the client has passed an invalid javax.faces.ViewState parameter, or when the associated view has been pruned from the LRU map which can by default hold 15 views. This is however not detectable inside a servlet filter before FilterChain#doFilter() is called. You really need to be inside the JSF context. You could do the backend session creating job in a PhaseListener. E.g. in beforephase of apply request values phase, which is guaranteed to be invoked only when there's a vaild view.
By the way, the FacesContext is not null in the filter because the session has timed out, but because the FacesServlet, the one responsible for creating it, hasn't been invoked yet at that point. You know, filters run before servlets.

Grails Webflow : Error could not initialize proxy - no Session when trying to access a domain set in PageScope

We have a custom tag similar to g:set which sets the current user into PageScope <n:currentUser var=”foobar”> It works great until we have a flowaction.
For a flowaction view state, which uses above tag, it will throw Lazy initialization exception “could not initialize proxy - no Session”, even though the user is loaded in the same request and set in pagescope.
Doesn’t webflow respect OpenSessionInView ! What’s going wrong here.
What could be the solution other then eager fetching and passing the modal explicitly.
(The tag is in a layout actually, which is applied for the view of the view state)
UPDATE
I just noticed, that even when accessing the the object right after it is loaded, it still gives the same error. So its not PageScope things causing the issue
Inside the tag
User user = User.get(x)
println user.foo.bar gives the same error
It looks like, for flow actions, session isn't kept open at all, and it seems to close right after the operation is complete.
Thanks
I've seen this error before, and not related to the webflow, but using a tag inside a layout. In this case the layout is handled after the session is closed and you need to create a new session manually.
def currentUser = { attrs ->
User.withTransaction {
User user = User.get(x)
}
}
The JIRA have the status won't fix because is not a good practice to make GORM queries inside TagLib's.

Resources