Vlad Balan
03/04/2020, 7:14 AMkotlin-native
by using the Native Debugging Support
plugin, but I get the following Error when running the target in debug mode:
Error running 'x64.test': com/jetbrains/cidr/ArchitectureType
Running it in run mode works fine
Does anybody know why I get this error?
Thanks in advance!andreasmattsson
03/04/2020, 9:58 AMEXC_BAD_ACCESS KERN_INVALID_ADDRESS
and pointing to
(anonymous namespace)::garbageCollect(MemoryState*, bool)
Any suggestions for how to troubleshoot this? It seems to be happening in pretty random places (e.g. the rest of the stack can look quite different from place to place, and analytics events suggests it is happening in a bunch of different views.
A few more (partial) sample stack traces:
Crashed: com.apple.main-thread
0 Deedster 0x1051847e4 (anonymous namespace)::garbageCollect(MemoryState*, bool) + 4313057252
1 Deedster 0x105194b40 ObjHeader* (anonymous namespace)::allocInstance<true>(TypeInfo const*, ObjHeader**) + 4313123648
2 Deedster 0x104a7fbd0 kfun:kotlin.collections.HashMap.hash#internal + 4305697744
3 CoreFoundation 0x193fa9938 -[NSDictionary getObjects:andKeys:count:] + 240
4 CoreFoundation 0x194114064 __NSDictionaryEnumerate + 624
5 Foundation 0x194530f50 _writeJSONObject + 424
6 Foundation 0x194531d1c ___writeJSONArray_block_invoke + 268
7 CoreFoundation 0x19409995c __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 16
0 Deedster 0x100a507e4 (anonymous namespace)::garbageCollect(MemoryState*, bool) + 4381165540
1 Deedster 0x100883658 objc2kotlin.3124 + 4379276888
2 ReactiveSwift 0x102ed9068 $s13ReactiveSwift6SignalC2on5event6failed9completed11interrupted10terminated8disposed5valueACyxq_GyAC5EventOyxq__GcSg_yq_cSgyycSgA3RyxcSgtFyAC8ObserverCyxq__G_AA8LifetimeCtXEfU_yAOcfU_ + 488
3 ReactiveSwift 0x102eea9a4 $s13ReactiveSwift6SignalC2on5event6failed9completed11interrupted10terminated8disposed5valueACyxq_GyAC5EventOyxq__GcSg_yq_cSgyycSgA3RyxcSgtFyAC8ObserverCyxq__G_AA8LifetimeCtXEfU_yAOcfU_TA + 52
4 ReactiveSwift 0x102ebfc28 $s13ReactiveSwift6SignalC8ObserverC4sendyyAC5EventOyxq__GF + 40
5 ReactiveSwift 0x102ed3604 $s13ReactiveSwift6SignalC4Core33_6DF632AE8A9288C3EAD8EFDF3D3AF99ELLC4sendyyAC5EventOyxq__GF + 780
6 ReactiveSwift 0x102ebfc28 $s13ReactiveSwift6SignalC8ObserverC4sendyyAC5EventOyxq__GF + 40
7 ReactiveSwift 0x102ef1354 $s13ReactiveSwift15TransformerCore33_8C2AEE826CBF26B7535B1491D314A4F4LLC5startyAA10Disposable_pAA6SignalC8ObserverCyxq__GAaF_pXEFAJyq0_q1__GAaF_pXEfU_yAH5EventOyxq__GcfU_ + 84
Crashed: com.apple.main-thread
0 Deedster 0x1017e47e4 (anonymous namespace)::garbageCollect(MemoryState*, bool) + 4388997092
1 Deedster 0x1017f490c ReleaseHeapRefStrict + 4389062924
2 Deedster 0x1017f1a64 ReadHeapRefLocked + 4389050980
3 Deedster 0x10114c7d4 kfun:kotlinx.coroutines.CancellableContinuationImpl.<get-state>$kotlinx-coroutines-core()kotlin.Any? + 4382083028
4 Flutter 0x102fb532c (Missing)
5 Flutter 0x102f558fc (Missing)
6 Flutter 0x102fa68dc (Missing)
7 Flutter 0x102f63628 (Missing)
andreasmattsson
03/04/2020, 9:58 AMCrashed: org.reactivecocoa.ReactiveObjC.RACScheduler.mainThreadScheduler
0 Deedster 0x1035e88ec (anonymous namespace)::garbageCollect(MemoryState*, bool) + 4314450156
1 Deedster 0x1035f8b40 ObjHeader* (anonymous namespace)::allocInstance<true>(TypeInfo const*, ObjHeader**) + 4314516288
2 Deedster 0x1030749c0 kfun:kotlinx.serialization.json.JsonObject.$toString$lambda-0$FUNCTION_REFERENCE$380.invoke#internal + 4308732352
3 Flutter 0x104c5dbcc (Missing)
4 Deedster 0x1033bd8c8 kfun:se.sdg12.deedster.flutter.channel.BlockFunctionImpl351.$<bridge-UNNN>invoke(kotlin.Any?)#internal + 4312176840
5 Deedster 0x102dd6230 partial apply for closure #1 in RacObservableMethodsIos.subscribe(receiver:next:error:completed:) + 262 (RxObservable+Utils.swift:262)
6 Deedster 0x102dd1e44 thunk for @escaping @callee_guaranteed (@guaranteed Swift.AnyObject?) -> () + 4305968708 (<compiler-generated>:4305968708)
7 ReactiveObjC 0x10594c500 -[RACSubscriber sendNext:] + 120
I found a few closed issues on the Kotlin Native github referring to garbageCollect
but they were closed as having been fixed / not reproducible in Kotlin 1.3.61, but that is already the version we are running.Kris Wong
03/04/2020, 8:26 PMspierce7
03/04/2020, 10:11 PM1.3.3-native-mt
of coroutines. @elizarov Is there an equivalent for 1.3.70?Lorin
03/05/2020, 1:33 AMnapperley
03/06/2020, 1:06 AM{
"status": "error",
"errorType": "bad_data",
"error": "invalid parameter 'query': parse error at char 1: no expression found in input"
}
Can someone please confirm if I have correctly set the headers/body for the HTTP request. Below is the Kotlin code I am using:
fun doHttpPost(url: String, headers: Map<String, String>, body: Map<String, String>): Unit = memScoped {
val headersList = alloc<curl_slist>()
headers.forEach { (k, v) -> curl_slist_append(headersList.ptr, "$k: $v") }
curl_easy_setopt(curlPost, CURLOPT_URL, url)
curl_easy_setopt(curlPost, CURLOPT_HTTPHEADER, headersList.next)
curl_easy_setopt(curlPost, CURLOPT_POSTFIELDS, createPostBody(body))
// Do HTTP POST.
curl_easy_perform(curlPost)
}
fun createPostBody(args: Map<String, String>) = buildString {
args.forEach { (k,v) -> append("&$k=$v") }
}.replaceFirst("&", "")
Originally headersList.ptr
was passed as an argument to curl_easy_setopt
however that caused a seg fault. Fixed the seg fault by passing through headersList.next
instead, although I am not sure if that is the correct way to do it.raniejade
03/06/2020, 3:34 AM1.3.70
release notes for kotlin native (https://github.com/JetBrains/kotlin-native/blob/master/CHANGELOG.md), there is an entry that piqued my interest: On-stack allocation using local escape analysis (GH-3625)
. Can anyone from the KN team elaborate more on this? (maybe @olonho?)Nikola Milovic
03/06/2020, 6:23 AMswishy
03/06/2020, 9:25 PMactual fun parse(xml: String) {
xml.usePinned {
val bytes = it.get().encodeToByteArray()
val pointer = StableRef.create(bytes)
val data = NSData.dataWithBytes(pointer.asCPointer(), bytes.size.toULong())
this.parser = NSXMLParser(data = data)
this.parser.delegate = this
this.parser.parse()
}
this.parser.setDelegate(null)
println("Parsing Done")
}
Delegate get called for start doc but then parsing fails with NSXMLParserErrorDomain error 4. which would indicate the NSData was empty but it doesnt appear to be the case, is there something Im missing?Thomas
03/06/2020, 10:25 PMfatal error: error in backend: Section too large, can't encode r_address (0x10022e9) into 24 bits of scattered relocation entry.
Does anyone know what this means? It only happens for the simulator. If I build for watchosArm64 there are no issues. Also when I build in release mode the issue is gone.
https://kotlinlang.slack.com/archives/C3SGXARS6/p1578922829122300?thread_ts=1578912211.116800&cid=C3SGXARS6Animesh Sahu
03/07/2020, 2:53 PMnapperley
03/08/2020, 3:28 AMcurl_easy_setopt(curlPost, CURLOPT_POSTFIELDS, createPostBody(body).cstr)
Is this the correct way to do it? With the verbose option for libcurl enabled the library prints out 6 for the content length (based on query=up), however the Prometheus server reports that the HTTP request body is missing.Animesh Sahu
03/08/2020, 4:44 AMJulio Zynger
03/08/2020, 5:31 PMevant
03/09/2020, 12:45 AMswishy
03/10/2020, 4:46 AMrusshwolf
03/10/2020, 4:00 PMframework
block is handled internally by the plugin. And doing something like targets.getByName<KotlinNativeTarget>("ios").binaries.getFramework("DEBUG").transitiveExport = true
doesn't appear to have any effect.Vlad Balan
03/10/2020, 4:44 PMtypedef struct {
uint8_t a;
} testStructDto;
is translated in Kotlin as follows:
@kotlinx.cinterop.internal.CStruct public final class testStructDto public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
public companion object : kotlinx.cinterop.CStructVar.Type {
}
public final var a: liboverlay.uint8_t /* = kotlin.UByte */ /* compiled code */
}
My Kotlin native function:
@ExperimentalUnsignedTypes
override fun init(): CPointer<testStructDto> {
val dtoVar = nativeHeap.alloc<testStructDto>()
dtoVar.a = 0xa5.toUByte()
return dtoVar.ptr
}
I can use it in Kotlin like this:
@Test
fun `initialize`() {
val context = controller.init()
assertEquals(0xa5.toUByte(), context.pointed.a)
}
But when I try to use it in C like this:
libtest_ExportedSymbols *libPtr = libtest_symbols()
libtest_kref_MyObjectFactory kFactory = libPtr->kotlin.root.MyObjectFactory._instance();
libtest_kref_MyObject kObject = libPtr->kotlin.MyObjectFactory.create(kFactory);
testStructDto *dto = (testStructDto *) libPtr->kotlin.root.MyObject.init(kObject);
I always get
dto->a = 32
I get the value 32
even if I assign something else than 0xa5
.
Does anybody know what I am doing wrong?
Thanks in advance!sean
03/10/2020, 5:37 PMserebit
03/10/2020, 9:15 PMgtk_new
builder functions) in a Kotlin class, how can I ensure that the pointers are being freed by program exit? If they were being allocated by Kotlin/Native and not GTK, I could use nativeHeap.free
, but I'm not sure how to handle it in this case.tylerwilson
03/12/2020, 2:25 PMe: java.lang.IllegalStateException: Symbol for deserialized class Boolean is unbound
anybody have any clue? It is not showing me what file it is failing on (just shows a list of all kt files). Thanks!Patrick
03/13/2020, 2:00 PMC:\Users\patri\AppData\Local\Temp\konan_temp5624724293383525973\result.o:out:(.text+0x3b70f3): undefined reference to `__imp_CoGetClassObject'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
e: C:\Users\patri\.konan\dependencies\msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1/bin/clang++ invocation reported errors
kevin.cianfarini
03/13/2020, 2:13 PMspierce7
03/13/2020, 8:00 PMkotlin {
android {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
publishAllLibraryVariants()
}
ios {
compilations.all {
cinterops {
create("firebasecore") {
packageName("cocoapods.FirebaseCore")
defFile = File("$projectDir/src/iosMain/c_interop/FirebaseCore.def")
includeDirs ("$projectDir/../iosApp/Pods/FirebaseCore/Firebase/Core/Public")
compilerOpts ("-F$projectDir/src/iosMain/c_interop/modules/FirebaseCore-6.0.2")
}
create("firestore") {
packageName("cocoapods.FirebaseFirestore")
defFile = File("$projectDir/src/iosMain/c_interop/FirebaseFirestore.def")
includeDirs ("$projectDir/../iosApp/Pods/FirebaseFirestore/Firestore/Source/Public", "$projectDir/../iosApp/Pods/FirebaseCore/Firebase/Core/Public")
compilerOpts ("-F$projectDir/src/iosMain/c_interop/modules/FirebaseFirestore-1.3.2")
}
}
}
}
// ...
}
Martin Gagnon
03/16/2020, 12:35 PMlinkDebugFrameworkIos
fails with "ld invocation reported errors" without any outputs. `linkReleaseFrameworkIos`` work really well. The issue arise as soon as I import the common dependency of Trikot.foundation
one of our shared code library (build.gradle -> https://github.com/mirego/trikot.foundation/blob/upgrade/kotlin-1.3.70/foundation/build.gradle ).
The library is imported as follow:
sourceSets {
commonMain {
dependencies {
api "com.mirego.trikot:foundation:$trikot_foundation_version"
Any help or hints would be appreciated. It was working A1 in 1.3.61 and before. Cheers!ritesh
03/16/2020, 2:01 PM@Parcelize
Any way, can i make use of typealias
and expect
and actual
without converting the domain pure kotlin module to android module?Kurt Renzo Acosta
03/17/2020, 5:15 AMPatrick
03/17/2020, 10:06 AMThe application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
ribesg
03/17/2020, 1:07 PMlinkDebugExecutableIos
.
It says
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
but there is no logs, so I don’t see what reported errors it’s about. Is there a way to obtain more logs? Passing --debug to gradle doesn’t do anything as I guess the error is in the call to konanc