I am running an Azure Function on Java with EventHub trigger. Now the function receives 1000s of messages per min. It is becoming difficult to track your changes after deployment as the logs are showing one day old content. Now even though I have commented out certain lines and added other lines to verify my changes, after deployment it still shows the commented lines. When I observed it, those were old logs. Is there any way to change that? As I have to wait a long time to see my changes on kudu console.
Where do I change the settings, so that my changes will reflect on basis of current changes?
Update:
I am using below setup in host.json. So may be because of the property "initialOffsetOptions/type" my function is processing already processed events after each deployment. I have got this link Slow down EventHubTrigger in Azure Function but I am yet to test it. Any suggestion on this is welcome.
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
},
"extensions": {
"eventHubs": {
"batchCheckpointFrequency": 5,
"eventProcessorOptions": {
"maxBatchSize": 256,
"prefetchCount": 512
},
"initialOffsetOptions": {
"type": "fromStart",
"enqueuedTimeUtc": ""
}
}
}
}
Now even though I have commented out certain lines and added other lines to verify my changes, after deployment it still shows the commented lines.
Make sure you check your deployment is done. And check for the Deployment history and last modified details of deployments in an Activity Log. (Resource Group -> Deployments -> Activity Log)
Is there any way to change that? As I have to wait a long time to see my changes on kudu console. Where do I change the settings, so that my changes will reflect on basis of current changes?
If you are using Consumption Plan, make sure you have to wait till your Function app restarts after deployment. After Deployment the Consumption Plan will take some time to sync the function trigger operation.
To avoid the problems, you can use the Premium App Service plan or enable Always On feature in your app service plan.
I have done a performance test of an REST API which is inserting data into MongoDB and also developed two applications using Java and Nodejs Express.
For testing, I have used JMeter which is invoking API 10 times (10 users) and realised that Java gave me consistent performance but Nodejs didn't.
Sometimes Nodejs app is taking more than 2ms to insert simple records into MongoDB.
As I have heard that Nodejs is faster for IO applications but did not find it.
Can someone tell me why I am not getting that performance or is my understanding or result I got is correct?
note: I am Java expert, learning Nodejs.
UPDATE :
I have created rest api which will insert records in mongodb and I am using mongoose to insert it . below is my code -
router.post("/", (req, res, next) => {
const order = new Order({
_id: new mongoose.Types.ObjectId(),
email: req.body.name,
uid: req.body.uid,
});
console.log(order);
order.save()
.then(result => {
console.log(result);
res.status(201).json({
message: "Order is successfully added",
});
})
.catch(err => {
console.log(err);
res.status(500).json({
error: err
});
});
});
I want to close my Android application with a method, but it should be shown a custom message (which I define for myself).
everything I found yet was "How to close my application" and I got more than 10 ways to close my application but I haven't found a way to set a custom message.
At the moment if my app crashes something like this appears:
[APPNAME] has been stopped
I want something like this
Congratulations! You found a bug, please submit it.
Is there even a way to do that? All methods I found just closed all activities or just forced an unresolveable error.
I don't think you need some code from me, but if you do, tell me.
(Language should be java and javascript/jQuery should be avoided)
You could try making a static stop method:
public static void stop(String message) {
Log.d(message);
System.exit(0);
}
I'm trying to port a Selenium script for an internal Webapp from Selenium IDE to a Selenium Grid setup with RemoteWebDrivers in Java.
The scripts work fine with Chrome and Firefox, but not in Internet Explorer. Every time I try to find an element in a page, I only get a NoSuchElementException (The page itself loads just fine).
Sample Code that exhibits the same behaviour using a Wikipedia page:
public class Wikipedia_test_IE {
private WebDriver driver = null;
private String baseUrl = null;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
#Before
public void setUp() throws Exception {
// DesiredCapabilities cap = DesiredCapabilities.firefox();
DesiredCapabilities cap = DesiredCapabilities.internetExplorer();
cap.setCapability(CapabilityType.VERSION, "9");
driver = new RemoteWebDriver (new URL("http://192.168.1.230:4444/wd/hub"), cap);
baseUrl = "https://en.wikipedia.org/wiki/Rosetta_%28spacecraft%29";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
#Test
public void testAKTargobankTestfall1KN() throws Exception {
driver.get(baseUrl);
driver.findElement(By.linkText("space probe")).submit();
}
}
I've tried using findElement(By.Id) and findElement(By.cssSelector) - no effect. Putting in a delay between pageload and the selection has no effect either, nor does using click instead of submit.
I've enabled debug logging of the IE Driver, but the Output doesn't help me to understand what the problem may be - hope someone else can.
server.cc(239) Command: POST /session {"desiredCapabilities":{"platform":"WINDOWS","ensureCleanSession":true,"browserName":"internet explorer","version":"9"}}
IESession.cpp(43) Mutex acquired for session initalization
IESession.cpp(105) Releasing session initialization mutex
command.cc(33) Raw JSON command: { "command" : "newSession", "locator" : { }, "parameters" : {"desiredCapabilities":{"platform":"WINDOWS","ensureCleanSession":true,"browserName":"internet explorer","version":"9"}} }
BrowserFactory.cpp(68) Ignoring Protected Mode Settings: 0
BrowserFactory.cpp(71) Checking validity of Protected Mode settings.
BrowserFactory.cpp(984) Detected IE version: 9, detected Windows version: 6
BrowserFactory.cpp(1074) Found Protected Mode setting value of 0 for zone 1
BrowserFactory.cpp(1074) Found Protected Mode setting value of 0 for zone 2
BrowserFactory.cpp(1074) Found Protected Mode setting value of 0 for zone 3
BrowserFactory.cpp(1074) Found Protected Mode setting value of 0 for zone 4
BrowserFactory.cpp(74) Has Valid Protected Mode Settings: 1
BrowserFactory.cpp(170) Starting IE using the IELaunchURL API
BrowserFactory.cpp(124) IE launched successfully with process ID 2188
BrowserFactory.cpp(130) Process with ID 2188 is executing iexplore.exe
BrowserFactory.cpp(313) Ignoring zoom setting: 0
BrowserFactory.cpp(581) Browser zoom level is 100%
IECommandExecutor.cpp(650) Persistent hovering set to: 1
ProxyManager.cpp(118) Using existing system proxy settings.
server.cc(308) Response: {"sessionId":"4aba017b-91e9-4f48-9f9f-f38b0464bb6b","status":303,"value":"/session/4aba017b-91e9-4f48-9f9f-f38b0464bb6b"}
server.cc(239) Command: GET /session/4aba017b-91e9-4f48-9f9f-f38b0464bb6b {}
command.cc(33) Raw JSON command: { "command" : "getSessionCapabilities", "locator" : { "sessionid" : "4aba017b-91e9-4f48-9f9f-f38b0464bb6b" }, "parameters" : {} }
IECommandExecutor.cpp(544) No alert handle is found
server.cc(308) Response: {"sessionId":"4aba017b-91e9-4f48-9f9f-f38b0464bb6b","status":0,"value":{"browserAttachTimeout":0,"browserName":"internet explorer","cssSelectorsEnabled":true,"elementScrollBehavior":0,"enableElementCacheCleanup":true,"enablePersistentHover":true,"handlesAlerts":true,"ie.browserCommandLineSwitches":"","ie.ensureCleanSession":false,"ie.forceCreateProcessApi":false,"ie.usePerProcessProxy":false,"ignoreProtectedModeSettings":false,"ignoreZoomSetting":false,"initialBrowserUrl":"http://localhost:15278/","javascriptEnabled":true,"nativeEvents":true,"platform":"WINDOWS","requireWindowFocus":false,"takesScreenshot":true,"unexpectedAlertBehaviour":"dismiss","version":"9"}}
server.cc(239) Command: POST /session/4aba017b-91e9-4f48-9f9f-f38b0464bb6b/timeouts/implicit_wait {"ms":30000}
command.cc(33) Raw JSON command: { "command" : "implicitlyWait", "locator" : { "sessionid" : "4aba017b-91e9-4f48-9f9f-f38b0464bb6b" }, "parameters" : {"ms":30000} }
IECommandExecutor.cpp(544) No alert handle is found
server.cc(308) Response: {"sessionId":"4aba017b-91e9-4f48-9f9f-f38b0464bb6b","status":0,"value":null}
server.cc(239) Command: POST /session/4aba017b-91e9-4f48-9f9f-f38b0464bb6b/url {"url":"https://en.wikipedia.org/wiki/Rosetta_%28spacecraft%29"}
command.cc(33) Raw JSON command: { "command" : "get", "locator" : { "sessionid" : "4aba017b-91e9-4f48-9f9f-f38b0464bb6b" }, "parameters" : {"url":"https://en.wikipedia.org/wiki/Rosetta_%28spacecraft%29"} }
IECommandExecutor.cpp(544) No alert handle is found
Browser.cpp(421) Navigate Events Completed.
Browser.cpp(452) Browser ReadyState is not '4', indicating 'Complete'; it was 1
Browser.cpp(421) Navigate Events Completed.
Browser.cpp(437) Browser busy property is true.
(The last two lines repeat several times)
ElementRepository.cpp(107) Refreshing managed element cache. Found 0 to remove from cache.
Browser.cpp(421) Navigate Events Completed.
Browser.cpp(476) Waiting for document to complete...
Browser.cpp(481) Not in navigating state
server.cc(308) Response: {"sessionId":"4aba017b-91e9-4f48-9f9f-f38b0464bb6b","status":0,"value":null}
server.cc(239) Command: POST /session/4aba017b-91e9-4f48-9f9f-f38b0464bb6b/element {"using":"link text","value":"space probe"}
command.cc(33) Raw JSON command: { "command" : "findElement", "locator" : { "sessionid" : "4aba017b-91e9-4f48-9f9f-f38b0464bb6b" }, "parameters" : {"using":"link text","value":"space probe"} }
IECommandExecutor.cpp(544) No alert handle is found
ElementFinder.cpp(49) Using FindElement atom to locate element having linkText = space probe
Browser.cpp(114) No child frame focus. Focus is on top-level frame
Script.cpp(485) -2147024891 [Zugriff verweigert]: Unable to execute code, call to IHTMLWindow2::execScript failed
Script.cpp(171) Cannot create anonymous function
ElementFinder.cpp(84) Unexpected error attempting to find element by mechanism linkText with criteria space probe
Any ideas?
Thanks for the help. To answer some of the Questions noted above, which i should have included in the original Post:
-Yes, it's indeed IE 9
-I had already set protected mode to enabled in all security zones
-using click instead of submit did not make a difference (initially)
It just so happens that the VM that's running the Selenium node applied security updates during the night, and that included one for IE.
At first, i got a different error message than i did before - IE was not able to find the browser window that was just opened, and the windows were not closed either. All the security settings had been reset by the update.
After re-enabling protected mode everything now works. As Richard noted i did need to change the find element to .click() instead of .submit().
So, everything now works, and i have no idea why. Thanks again!
You should probably be using click(), not submit():
driver.findElement(By.linkText("space probe")).click();
I also had got also that error on tests that worked fine on FF but not on IE.
I can suggest you:
To check the protected mode settings on IE.
To disable native events on the IE driver.
To Use JavaScript on those particular cases (The worst one on my point of view).
This is a known problem with the IE driver.
http://jimevansmusic.blogspot.be/2012/08/youre-doing-it-wrong-protected-mode-and.html
http://jimevansmusic.blogspot.be/2013/01/revisiting-native-events-in-ie-driver.html
Try to use InternetExplorerDriver instead of RemoteWebDriver normally it shouldn't make a difference but with IE all is possible-.-
I got similar problems and I end up with the following Code which works for me:
#Before
public void setUp() {
//... some irrelevant Code ...
System.setProperty("webdriver.ie.driver", "Path to IEDriver.exe");
InternetExplorerDriver driver = new InternetExplorerDriver();
//... some irrelevant Code ...
}
You can write your code in the following way:
while(true) {
try {
driver.findElement(By.linkText("space probe")).submit();
break;
} catch (Exception e) {
continue;
}
}
I write my code like this so that the thread searches until success. When using implicitlyWait, the browser will only wait for the maximum of that time. But it may happen that your browser page loading has been completed but the desired portion is loaded by an ajax call. In that case your program will throw an error.
I've been learning Google Endpoints from the tutorial at https://developers.google.com/appengine/docs/java/endpoints/. I got the Endpoint successfully deployed to Google App Engine and I managed to build a simple iPhone app that calls the Endpoint. However, my iPhone app gets the following error when it tries to call the Endpoint:
Error Message
error NSError * domain: #"com.google.GTLJSONRPCErrorDomain" - code: -32099 0x00000001094518a0
_userInfo __NSDictionaryI * 3 key/value pairs 0x00000001094452b0
[0] (null) #"error" : #"java.lang.IndexOutOfBoundsException: Index: 0, Size: 0"
[1] (null) #"NSLocalizedFailureReason" : #"(java.lang.IndexOutOfBoundsException: Index: 0, Size: 0)"
[2] (null) #"GTLStructuredError" : (no summary)
iPhone API Caller (in Objective-C running in Xcode Debugger)
- (IBAction)myButton:(id)sender {
NSInteger myId;
if (self.mySwitch.isOn) {
myId = 0;
}
else {
myId = 1;
}
GTLQueryHelloworld *query = [GTLQueryHelloworld queryForGreetingsGetGreetingWithIdentifier:myId];
[self.helloWorldService executeQuery:query completionHandler:^(GTLServiceTicket *ticket, id object, NSError *error) {
if (!error) {
[self.myLabel setText:object];
}
else {
[self.myLabel setText:[error description]]; // This line gets called
}
}];
}
I found the same error message reported in Youtube video upload fails after 100 % progress for some users with Backend Error code:-32099 but that pertained to calling YouTube and it was eventually closed as a bug that was fixed. So I don't think it's related.
I believe the bug is on the client side because I put some logging on the server (Java) and it does not appear to get called:
public class Greetings {
private static final Logger log = Logger.getLogger(Greetings.class.getName());
public static ArrayList<HelloGreeting> greetings = new ArrayList<HelloGreeting>();
static {
log.setLevel(Level.INFO);
greetings.add(new HelloGreeting("hello world!"));
greetings.add(new HelloGreeting("goodbye world!"));
}
public HelloGreeting getGreeting(#Named("id") Integer id) {
log.info("HelloGreeting called with getGreeting");
log.info("getGreeting id " + id);
return greetings.get(id);
}
I don't see "HelloGreeting called with getGreeting" in my Google server logs, all I see is the log message indicating that my Endpoint project was successfully deployed:
21:56:45.639 Endpoints: https://1-war-dot-firstendpointproject.appspot.com/_ah/api/helloworld#v1 Saved
I've also confirmed I can successfully test the helloworld.greetings.getGreeting API from the deployed API explorer for my project:
https://1-war-dot-firstendpointproject.appspot.com/_ah/api/explorer
When I call the API from the Explorer it generates a log message:
24.130.150.54 - - [19/Jun/2014:21:17:45 -0700] "POST /_ah/spi/com.google.appengine.samples.helloendpoints.Greetings.getGreeting HTTP/1.1" 200 93 "https://1-war-dot-firstendpointproject.appspot.com/ah/api/static/proxy.html?jsh=m%3B%2F%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.htta44JhPmg.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Fz%3Dzcms%2Frs%3DAItRSTPk1CJ1YqUCyb-H-zhkQTjKPZwvbQ" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14" "1-war-dot-firstendpointproject.appspot.com" ms=17 cpu_ms=87 cpm_usd=0.000010 instance=00c61b117ce13f56d6eb483511c2c1bcd24241 app_engine_release=1.9.6
It does not generate "HelloGreeting called with getGreeting" but I suspect that is because I have not configured the logger. At any rate, when my client calls the Endpoint I get no log message at all. Since the API explorer call at least generates 1 log message, I suspect the problem is on the client.
Questions:
1] Is the error I'm seeing generated on the client or the server side?
2] Do you know what array this error is refering to?
3] What are some techniques for debugging a connection problem like this?
Thanks for your help StackOverflowers!
Michael
I think what's going on is as the following: The server runs into an unexpected situation (specifically: it throws an unhanded IndexOutOfBoundsException), hence it cannot return the kind of JSON that the generated client stub expects in its HTTP response (specifically: it returns HTTP status 500 instead of 2xx). The client stub reports this as NSError with domain com.google.GTLJSONRPCErrorDomain and code 32099. The JSON-RPC 2.0 spec defines this error code as "reserved for implementation-defined server-errors".
It would seem that the best way to handle this is add appropriate exception handling either on the server- or client-side, depending on what exactly caused the unexpected situation on the server. An IndexOutOfBoundsException is most likely for the server to handle, as it may stem from an application-level bug.
So to answer the verbatim question: the (original) error is on the server. BTW, unlike the OP I do see related JUL logging output in the Google Developers Console.
I looked at your endpoint and successfully called it in the explorer and with curl. I am pretty sure that the problem is in the client and the server doesn't understand the request.
If you are sure you are calling the client correctly, I would try regenerating it. Perhaps there has been a bugfix since the last time you generated.