Status Update
Comments
je...@gmail.com <je...@gmail.com> #2
In the original case I had both the app and library's build-tools version set to 33.0.0.
Oddly, however, I still see the same issue if I leave either the app or the library's build-tools version set to 33.0.0.
ma...@gmail.com <ma...@gmail.com> #3
The execution "succeeds" in a command line and also from the Gradle build, and the Java file is generated from the AIDL file, but the problem is the return code from the call is incorrect.
You can run it in a command line and then echo %errorlevel% and you will notice in 33.0.0 that the return code is something like -1073740940 but when you run the same exact command with 32.0.0 the return code is 0.
The Gradle plugin notices this and fails the build.
NB: The aidl.exe doesn't actually have code to return anything other than 0 or 1 from its main function. Probably there is some stack corruption or similar due to a memory bug. If you take the aidl.exe file and run it in a debugger like IDA it immediately throws an exception due to a use-after-free error. This doesn't happen with the 32.0.0 version which leads me to believe some bug was introduced in 33.0.0. It also doesn't happen if you force the buggy aidl.exe to run in Windows 7 compatibility mode, probably because there are less checks for memory corruption (or perhaps DEP is disabled) that are triggered when you run it under Windows 10 or 11.
so...@google.com <so...@google.com>
je...@google.com <je...@google.com> #4
Jean Luc, can you have a look asap that it is not a widespread issue, thanks !
je...@google.com <je...@google.com> #5
Can confirm this issue is reproducible in windows. Aidl is exiting with non-zero exit code and without any message
> C:\Users\jeanlucncoelho\AppData\Local\Android\Sdk\build-tools\33.0.0\aidl.exe -pC:\Users\jeanlucncoelho\AppData\Local\Android\Sdk\platforms\an
droid-33\framework.aidl -oC:\Users\jeanlucncoelho\project\build\generated\aidl_source_output_dir\debug\out -IC:\Users\jeanlucncoelho\project\src\main\aidl -IC:\Users\jeanlucncoelho\project\src\debug\aidl -dC:\Users\JEANLU~1\AppData\Local\Temp\aidl7877085528088218597.d C:\Users\jeanlucncoelho\project\src\main\aidl\com\example\helloworld\IRenamed.aidl
> echo $LASTEXITCODE
-1073740940
What is strange to me is this argument
-dC:\Users\JEANLU~1\AppData\Local\Temp\aidl7877085528088218597.d
if I look for it windows will tell me it's there
> ls C:\Users\JEANLU~1\AppData\Local\Temp\aidl7877085528088218597.d
Directory: C:\Users\jeanlucncoelho\AppData\Local\Temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 6/28/2022 8:18 PM 726 aidl7877085528088218597.d
But the same thing goes if I replace it with my actual username
ls C:\Users\jeanlucncoelho\AppData\Local\Temp\aidl7877085528088218597.d
Directory: C:\Users\jeanlucncoelho\AppData\Local\Temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 6/28/2022 8:24 PM 726 aidl7877085528088218597.d
and aidl seems to succeed if I replace it with my proper username.
I don't know if we are seeing the same bug.
Error while executing process ...\aidl.exe with arguments {-p...}) and the run
echo $LASTEXITCODE` and tell me what it says?
je...@google.com <je...@google.com> #6
@jiyong do you know what might be happening here?
ji...@google.com <ji...@google.com> #7
-1073740940 (0xc0000374) is a heap corruption exception on Windows.
It would have been nice if com.android.builder.internal.compiler.AidlProcessor.call
provided some stack trace or at least stdout/stderr from the AIDL process which are expected to have erorr/log messages. Then using them we could know where the heap corruption occurred.
je...@google.com <je...@google.com> #8
I don't think AGP suppresses stdout or stderr from aidl. I tried running it manually and got the same error code from it, with no error message or stack trace.
I was able to reproduce it with the AidlTest project in tools/base. Can we try building a debug version of aidl and replacing it in build tools 33.0.0 in the sdk and seeing if it gives you a stacktrace?
FYI the error only happens on windows as far as I can tell.
ji...@google.com <ji...@google.com> #9
I have no experience debugging an app on Windows. AIDL compiler is already built with
is...@gmail.com <is...@gmail.com> #10
in...@google.com <in...@google.com> #11
I found that heap is sometimes corrupted even with no arguments.
.\aidl.exe; echo $LASTEXITCODE
randomly gives 1, -1073740940, -1073741819.
in...@google.com <in...@google.com> #12
I tried patching main (0x2d1540) to
push 12
pop eax
ret
And it still sometimes crashes. So I guess this should be a problem of some global variables.
in...@google.com <in...@google.com> #13
With windbg I found mysterious heap corruption. It was full of strings, and they were all freed and filled with feee
(Windows's free-heap filling bytes). In the middle of that, there are strange values.
However, still not sure what is the cause.
je...@google.com <je...@google.com>
ji...@google.com <ji...@google.com> #14
Filed
in...@google.com <in...@google.com> #15
FWIW, we found the root cause.
AidlNode
is destructed whenAidlTypeSpecifier
is destructed.- The destruction order between
AidlNode::unvisited_locations_
andAidlTypeSpecifier
is indetermined. - On windows builds,
AidlNode::unvisited_locations_
is destructed prior toaidl_to_ndk.cpp
'sAidlTypeSpecifier
, resulting inpush_back
to an already destructed vector. - On linux builds,
AidlNode::unvisited_locations_
is destructed in the end, so there are no crashes.
in...@google.com <in...@google.com> #16
xa...@google.com <xa...@google.com> #17
+Raju to organize a release of a new build tools (33.0.1) with the fix
ra...@google.com <ra...@google.com> #18
xa...@google.com <xa...@google.com> #19
Ah, thanks for the update Raju!
je...@gmail.com <je...@gmail.com> #20
There was mention of a build-tools 33.0.1 below.
But this has not yet come to pass, over a month later.
And now Android 13 has been released. I assume it is not required, but it would seem ideal to move to build-tools 33.0.x while moving to target SDK 33...
je...@gmail.com <je...@gmail.com> #21
I gave up and ripped all the old AIDL out of the code -- as we're currently not using it.
I'm surprised no one is:
- using AIDL,
- building on Windows, and
- wanting to use the latest build-tools
an...@gmail.com <an...@gmail.com> #22
Deleting Build Tools 33.0.0 and reinstalling fixes issue sometimes.
But it is not a permanent fix.
Please share ETA for the build tool release with fix applied.
Thank you.
ga...@linecorp.com <ga...@linecorp.com> #23
Is there any progress? It is already year-end.
st...@gmail.com <st...@gmail.com> #24
cm...@google.com <cm...@google.com> #25
Build tools 33.0.1 is released as of yesterday
We'll be updating the default in AGP, currently targeting 8.0, but might slip to 8.1 if more problems are found
ps...@gmail.com <ps...@gmail.com> #26
hm...@google.com <hm...@google.com>
cm...@google.com <cm...@google.com> #28
Punted updating the default to AGP 8.1 as Build tools release with the fix is not ready yet
ar...@gmail.com <ar...@gmail.com> #29
3i...@gmail.com <3i...@gmail.com> #30
พัฒนา
3i...@gmail.com <3i...@gmail.com> #31
ซอฟแวร์
al...@gmail.com <al...@gmail.com> #32
al...@gmail.com <al...@gmail.com> #33
ch...@gmail.com <ch...@gmail.com> #34
Command: C:\Users\DELL\Downloads\flutter_windows_3.7.6-stable\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\Users\DELL\Downloads\flutter_windows_3.7.6-stable\flutter\bin\cache\dart-sdk\bin\snapshots\frontend_server.dart.snapshot --sdk-root C:\Users\DELL\Downloads\flutter_windows_3.7.6-stable\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --target=flutter --no-print-incremental-dependencies -Dflutter.inspector.structuredErrors=true -DFLUTTER_WEB_AUTO_DETECT=true -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --no-link-platform --packages D:\practice\.dart_tool\package_config.json --output-dill D:\practice\.dart_tool\flutter_build\04523534c1a3dbfdd16eb9d4006a6c92\app.dill --depfile D:\practice\.dart_tool\flutter_build\04523534c1a3dbfdd16eb9d4006a6c92\kernel_snapshot.d --incremental --initialize-from-dill D:\practice\.dart_tool\flutter_build\04523534c1a3dbfdd16eb9d4006a6c92\app.dill --source file:///D:/practice/.dart_tool/flutter_build/dart_plugin_registrant.dart --source package:flutter/src/dart_plugin_registrant.dart -Dflutter.dart_plugin_registrant=file:///D:/practice/.dart_tool/flutter_build/dart_plugin_registrant.dart --verbosity=error package:practice/main.dart
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\DELL\Downloads\flutter_windows_3.7.6-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1151
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\DELL\Downloads\flutter_windows_3.7.6-stable\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at
BUILD FAILED in 14s
Exception: Gradle task assembleDebug failed with exit code 1
[Deleted User] <[Deleted User]> #35
Isn't this fixed already? Why is this blocking a release when it was fixed in built tools 33.0.1?
hm...@google.com <hm...@google.com> #36
Yes, this is now fixed. The default version of build-tools from AGP 8.2 alpha version and onwards should be 34.0.0-rc3 which includes all build tool related fixes.
ki...@gmail.com <ki...@gmail.com> #37
gimana?
Description
Existing Android library project that is building and running fine with
build-tools
32.0.0
fails to build with build-tools33.0.0
(changing nothing else).Exception report generated by building with
--stacktrace
atttached.Note that obtaining the command line from the exception report and executing this in a cmd shell succeeds, so I am guessing this is due to nuances of execution from within Gradle, etc (perhaps UAC mess?!? this is Windows after all).
Build: AI-212.5712.43.2112.8609683, 202205181650,
AI-212.5712.43.2112.8609683, JRE 11.0.12+7-b1504.28-7817840x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1920.0x1080.0
AS: Chipmunk | 2021.2.1 Patch 1; Kotlin plugin: 212-1.7.0-release-281-AS5457.46; Android Gradle Plugin: 7.2.1; Gradle: 7.4.2; Gradle JDK: version 11.0.15; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: LLDB 3.1 (revision: 3.1.4508709); CMake: from local.properties: (not specified), latest from SDK: 3.18.1-g262b901-dirty, from PATH: (not found)Source: send_feedback_icon