appium / appium/java-client

Not able to generate 'appium_perf_Leaks_.trace' due to error 'Encountered internal error running command'

Open
#1,312 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

The problem

I am trying to get the Leaks trace for my iOS app, I m starting the log once app launches and before test starts command used is ::
args.put("timeout", 60 * 1000);
args.put("profileName", "Leaks");
args.put("pid", "current");
When test completes I stop the monitoring, while stopping it gives error saying :

[35m[XCUITest][39m There are no records for performance profile 'Leaks' and device 527a368d34b35b04c6e8b53bde75d3795a61733e. Have you started the profiling before?

Environment

  • Appium version (or git revision) that exhibits the issue: 1.16.0
  • Desktop OS/version used to run Appium: macbook pro Catalina 10.15.1
  • Node.js version (unless using Appium.app|exe):
  • Npm or Yarn package manager:
  • Mobile platform/version under test: iOS 12.4.1
  • Real device or emulator/simulator: Real (iPad 6th generation)
  • Appium CLI or Appium.app|exe: CLI

Details

In appium logs while executing script 'stopPerfRecord' it shows:

2020-03-11 10:09:35:566 [HTTP] {"script":"mobile: stopPerfRecord","args":[{"profileName":"Leaks"}]}
2020-03-11 10:09:35:567 [W3C (9d2bf21f)] Calling AppiumDriver.execute() with args: ["mobile: stopPerfRecord",[{"profileName":"Leaks"}],"9d2bf21f-b658-4f06-92f1-c6d918dc1c6c"]
2020-03-11 10:09:35:567 [XCUITest] Executing command 'execute'
2020-03-11 10:13:33:050 [XCUITest] The size of the file is 475.45 MB
2020-03-11 10:13:34:130 [XCUITest] There are no records for performance profile 'Leaks' and device 527a368d34b35b04c6e8b53bde75d3795a61733e. Have you started the profiling before?
2020-03-11 10:13:36:703 [W3C (9d2bf21f)] Responding to client with driver.execute() result: "UEsDBAoAAAAAACF8a1AAAAAAAAAAAAAAAAAmABwAYXBwaXVtX3BlcmZfTGVha3NfMTU4MzkyMDg2NTI0NC50cmFjZS9VVAkAA1a3aF5nuGhedXgLAAEE9gEAAAQUAAAAUEsDBAoAAAAAACF8a1AAAAAAAAAAAAAAAAA2ABwAYXBwaXVtX3BlcmZfTGVha3NfMTU4MzkyMDg2NTI0NC50cmFjZS9pbnN0cnVtZW50X2RhdGEvVVQJAANWt2heZ7hoXnV4CwABBPYBAAAEFAAAAFBLAwQKAAAAAAAhfGtQAAAAAAAAAAAAAAAAWwAcAGFwcGl1bV9wZXJmX0xlYWtzXzE1ODM5MjA4NjUyNDQudHJhY2UvaW5zdHJ1bWVudF9kYXRhL0Y5RjJCMTQ3LUEwNDItNDNGMC1BNzkxLUVBNkQ2M0M3QzFFOC9VVAkAA1a3aF5nuGhedXgLAAEE9gEAAAQUAAAAUEsDBAoAAAAAACF8a1AAAAAAAAAAAAAAAABkABwAYXBwaXVtX3BlcmZfTGVha3NfMTU4MzkyMDg2NTI0NC50cmFjZS9pbnN0cnVtZW50X2RhdGEvRjlGMkIxNDctQTA0Mi00M0YwLUE3OTEtRUE2RDYzQzdDMUU4L3J1bl9kYXRhL1VUCQADVrdoXme4aF51eAsAAQT2AQAABBQAAABQSwMEFAACAAgAIXxrUBLgp8HeQgAAt0MAAG0AHABhcHBpdW1fcGVyZl9MZWFrc18xNTgzOTIwODY1MjQ0LnRyYWNlL2luc3RydW1lbnRfZGF0YS9GOUYyQjE0Ny1BMDQyLTQzRjAtQTc5MS1FQTZENjNDN0MxRTgvcnVuX2RhdGEvMS5ydW4uemlwVVQJAANWt2heVrdoXnV4CwABBPYBAAAEFAAAANW883OnT/AvGtt2NhtsbNu2bdu2nWw29sa2/Y5t8x3b9t3P95xbdetWnT/gzNTTM1M93fPq7qmp6ueHVpQBh8AAAQGBASHxtVHcj0w56xQCAZHD...
2020-03-11 10:13:41:165 [W3C (9d2bf21f)] Encountered internal error running command: Error: There are no records for performance profile 'Leaks' and device 527a368d34b35b04c6e8b53bde75d3795a61733e. Have you started the profiling before?
2020-03-11 10:13:41:166 [W3C (9d2bf21f)] at Object.wrappedLogger.errorAndThrow (/usr/local/lib/node_modules/appium/node_modules/appium-support/lib/logging.js:74:35)
2020-03-11 10:13:41:167 [W3C (9d2bf21f)] at XCUITestDriver.mobileStopPerfRecord (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/performance.js:196:9)
2020-03-11 10:13:41:167 [W3C (9d2bf21f)] at XCUITestDriver.executeMobile (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/execute.js:97:16)
2020-03-11 10:13:41:168 [W3C (9d2bf21f)] at XCUITestDriver.execute (/usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/lib/commands/execute.js:15:23)
2020-03-11 10:13:41:168 [W3C (9d2bf21f)] at XCUITestDriver.execute (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/commands/execute.js:16:27)
2020-03-11 10:13:41:169 [W3C (9d2bf21f)] at commandExecutor (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:330:9)
2020-03-11 10:13:41:169 [W3C (9d2bf21f)] at /usr/local/lib/node_modules/appium/node_modules/async-lock/lib/index.js:125:12
2020-03-11 10:13:41:170 [W3C (9d2bf21f)] at AsyncLock._promiseTry (/usr/local/lib/node_modules/appium/node_modules/async-lock/lib/index.js:249:31)
2020-03-11 10:13:41:170 [W3C (9d2bf21f)] at exec (/usr/local/lib/node_modules/appium/node_modules/async-lock/lib/index.js:124:9)
2020-03-11 10:13:41:170 [W3C (9d2bf21f)] at taskFn (/usr/local/lib/node_modules/appium/node_modules/async-lock/lib/index.js:152:4)
2020-03-11 10:13:41:171 [W3C (9d2bf21f)] at done (/usr/local/lib/node_modules/appium/node_modules/async-lock/lib/index.js:93:29)
2020-03-11 10:13:41:171 [W3C (9d2bf21f)] at /usr/local/lib/node_modules/appium/node_modules/async-lock/lib/index.js:128:5

Link to Appium logs

https://gist.github.com/sanjeedsawant/8186abbe23fb7b73629d04d841654d51

Code To Reproduce Issue [ Good To Have ]

Launch the app under test

@BeforeMethod
private void startPerformanceMonitoring() {
	
		Map<String, Object> args = new HashMap<>();
		args.put("timeout", 60 * 1000);
		args.put("profileName", "Leaks");
		args.put("pid", "current");
                (JavascriptExecutor)this.driver.executeScript("mobile: startPerfRecord", args);
	}

@Test
public void demoTest(){
     //some interaction with the app
}

@AfterMethod
public void stopPerfReport() {
		File traceFileZip = new File(System.getProperty("user.dir") + File.separator + "src/test/resources/perfResult/"
				+ System.currentTimeMillis() + ".zip");
		LOG.info("Closing the perfomance logs and wrting to file: " + traceFileZip.getAbsolutePath());
		args = new HashMap<>();
		args.put("profileName", "Leaks");
		String b64Zip = (String) (JavascriptExecutor)this.driver.executeScript("mobile: stopPerfRecord", args);
		byte[] bytesZip = Base64.getMimeDecoder().decode(b64Zip);
		FileOutputStream stream;
		try {
			stream = new FileOutputStream(traceFileZip);
			stream.write(bytesZip);
                 }
                 catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stopPerfRecord call in the supplied Java reproduction and inspect appium-xcuitest-driver/lib/commands/performance.js at mobileStopPerfRecord, as identified in the stack trace. Run the reproduction on the stated iOS device and review the linked logs. Done means stopping the Leaks profile completes without the internal error and returns a usable trace archive.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, java
Domain
mobile-dev, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.