The rule is that the first call MUST have Authorization header, and at first call OrientDB returns the OSESSIONID. On further calls just pass this header containing the OSESSIONID in the request and OrientDB will skip the authentication.
Lvc@ On 1 April 2014 21:27, Gaurav Dhiman <[email protected]> wrote: > While developing short testcase for this case, I noticed the issue comes > only if I am doing simultaneous async calls to OrientDB without > Authorization header in HTTP request. > If I give Authorization header in each simultaneous aync call, it works > fine. > If I do not give Authorization header, only the first call succeed rest > all return 401 error. > > Any reason for it ? I will soon share the test case. > > Regards, > Gaurav > > > On Wednesday, March 19, 2014 10:33:15 PM UTC+5:30, Gaurav Dhiman wrote: > >> Luca, sure I will provide you the running test case soon. >> >> Regards, >> Gaurav >> >> >> >> On Wed, Mar 19, 2014 at 8:21 PM, Luca Garulli wrote: >> >>> Hi Gaurav, >>> in order to have more chance to have a fast answer, can you provide >>> something we can reproduce in short time? >>> >>> If you send us a Angular.js snippet I should: >>> >>> 1) download Angular.js >>> 2) understand how it works >>> 3) create a HTML page >>> 4) copy your snippet on it >>> 5) hacking to get it working >>> >>> Can you reproduce the problem for example using ab (by Apache) that is >>> part of our distribution under "benchmarks" ? >>> >>> Lvc@ >>> >>> >>> >>> On 19 March 2014 15:32, Gaurav Dhiman wrote: >>> >>>> @Luca, >>>> >>>> Sorry for bothering you, but its imp for me. >>>> Any update on this ? >>>> >>>> Regards, >>>> Gaurav >>>> >>>> >>>> On Wednesday, March 19, 2014 10:54:02 AM UTC+5:30, Gaurav Dhiman wrote: >>>>> >>>>> Luca, >>>>> >>>>> Were you able to re-produce the issue with the code that I shared ? >>>>> I am hitting road block with OrientDB on every turn, lowering my >>>>> confidence on it. >>>>> >>>>> Before Orient I was using Wakanda, the only issue with that was >>>>> scaling out that turned me to explore other DB like Arango and Orient. >>>>> Making Orient work is not as easy as with >>>>> Wakanda<http://www.wakanda.org/>. >>>>> It will be great if Orient can have its feature set along with ease of >>>>> Wakanda. >>>>> >>>>> Regards, >>>>> Gaurav >>>>> >>>>> >>>>> On Tuesday, March 18, 2014 11:43:06 PM UTC+5:30, Gaurav Dhiman wrote: >>>>>> >>>>>> @Lvc, Below is the client code (AngularJS) used. >>>>>> >>>>>> ============== >>>>>> $scope.getInitialData = function() { >>>>>> if (window.appInitialized) { >>>>>> return; >>>>>> } >>>>>> window.appInitialized = true; >>>>>> // Get all businesses of logged-in user >>>>>> url = $scope.getAbsoluteBackendURL('function/fsdb/ >>>>>> getbusinessesofmerchant'); >>>>>> $http.get(url) >>>>>> .success(function(data, status) { >>>>>> if ((status == "200") && (data.result.length) && >>>>>> (data.result.length > 0)) { >>>>>> data.result = cleanJSON(data.result); >>>>>> $scope.businesses = data.result; >>>>>> } else { >>>>>> $scope.businesses = []; >>>>>> } >>>>>> }) >>>>>> .error($scope.ajaxErrorHandler); >>>>>> // Get all products of logged-in user >>>>>> url = $scope.getAbsoluteBackendURL('function/fsdb/ >>>>>> getproductsofmerchant'); >>>>>> $http.get(url) >>>>>> .success(function(data, status) { >>>>>> if ((status == "200") && (data.result.length) && >>>>>> (data.result.length > 0)) { >>>>>> data.result = cleanJSON(data.result); >>>>>> $scope.products = data.result; >>>>>> } else { >>>>>> $scope.products = []; >>>>>> } >>>>>> }) >>>>>> .error($scope.ajaxErrorHandler); >>>>>> // Get all base products in DB, across all vendors. >>>>>> url = $scope.getAbsoluteBackendURL('function/fsdb/ >>>>>> getallbaseproducts'); >>>>>> $http.get(url) >>>>>> .success(function(data, status) { >>>>>> if ((status == "200") && (data.result.length) && >>>>>> (data.result.length > 0)) { >>>>>> data.result = cleanJSON(data.result); >>>>>> $scope.baseProducts = data.result; >>>>>> } else { >>>>>> $scope.baseProducts = []; >>>>>> } >>>>>> }) >>>>>> .error($scope.ajaxErrorHandler); >>>>>> // Get all master countries >>>>>> url = $scope.getAbsoluteBackendURL(' >>>>>> function/fsdb/getallcountries'); >>>>>> $http.get(url) >>>>>> .success(function(data, status) { >>>>>> if ((status == "200") && (data.result.length) && >>>>>> (data.result.length > 0)) { >>>>>> data.result = cleanJSON(data.result); >>>>>> $scope.masterCountries = data.result; >>>>>> alert("No. of Countries - "+data.result.length); >>>>>> } else { >>>>>> $scope.masterCountries = []; >>>>>> } >>>>>> }) >>>>>> .error($scope.ajaxErrorHandler); >>>>>> }; >>>>>> ============== >>>>>> >>>>>> >>>>>> On server end, the called functions are simple function that return >>>>>> records based on some select query. Below is one example: >>>>>> >>>>>> ========================= >>>>>> // Returns business listing of currently logged-in merchant >>>>>> user = request.getUser(); >>>>>> if (user) { >>>>>> var businesses = db.query("SELECT FROM business WHERE user.name = >>>>>> ?", user); >>>>>> return businesses; >>>>>> } >>>>>> return []; >>>>>> ========================= >>>>>> >>>>>> I hope it will help you to reproduce the issue. >>>>>> >>>>>> Regards, >>>>>> Gaurav >>>>>> >>>>>> >>>>>> >>>>>> On Tuesday, March 18, 2014 8:12:34 PM UTC+5:30, Lvc@ wrote: >>>>>>> >>>>>>> Hi, >>>>>>> Server side functions are multi-thread. How can I reproduce this >>>>>>> behavior? >>>>>>> >>>>>>> Lvc@ >>>>>>> >>>>>>> >>>>>>> On 18 March 2014 15:27, Gaurav Dhiman <[email protected]> wrote: >>>>>>> >>>>>>>> During initializing my app , I do some simultaneous async HTTP/REST >>>>>>>> access to OrientDB. >>>>>>>> It leads to below behavior. >>>>>>>> >>>>>>>> First HTTP/REST call succeed, all others return with 401 HTTP >>>>>>>> error. Later if I do the same calls through browser, they all succeed. >>>>>>>> >>>>>>>> Why can not we access OrientDB multiple times at same time ? I am >>>>>>>> using server defined function to access OrientDB over HTTP/REST. >>>>>>>> >>>>>>>> Attached is the screenshot of chrome debugger. >>>>>>>> >>>>>>>> Regards, >>>>>>>> Gaurav >>>>>>>> >>>>>>>> -- >>>>>>>> >>>>>>>> --- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "OrientDB" group. >>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to [email protected]. >>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>> >>>>>>> >>>>>>> -- >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "OrientDB" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> >>> --- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "OrientDB" group. >>> To unsubscribe from this topic, visit https://groups.google.com/d/ >>> topic/orient-database/NRYFZtqwNXM/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
