Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Under Windows, OSHI and kotlin are not compatible #44

Open
galaxyeye opened this issue Sep 11, 2023 · 1 comment
Open

Under Windows, OSHI and kotlin are not compatible #44

galaxyeye opened this issue Sep 11, 2023 · 1 comment

Comments

@galaxyeye
Copy link
Collaborator

The package com.sun.jna comes with kotlin, but there is no close() method in com.sun.jna.Memory.

2023-09-11 21:47:40.489 INFO [main] a.p.p.p.b.e.c.BasicPrivacyContextManager - Privacy context is created #091119IXKO1
java.lang.NoSuchMethodError: com.sun.jna.Memory.close()V
at oshi.util.Util.freeMemory(Util.java:83)
at oshi.jna.ByRef$CloseableHANDLEByReference.close(ByRef.java:95)
at oshi.software.os.windows.WindowsOperatingSystem.enableDebugPrivilege(WindowsOperatingSystem.java:469)
at oshi.software.os.windows.WindowsOperatingSystem.(WindowsOperatingSystem.java:105)
at oshi.SystemInfo.createOperatingSystem(SystemInfo.java:82)
at oshi.util.Memoizer$1.get(Memoizer.java:61)
at oshi.SystemInfo.getOperatingSystem(SystemInfo.java:76)
at ai.platon.pulsar.common.AppSystemInfo$Companion.isOSHIAvailable(AppSystemInfo.kt:132)
at ai.platon.pulsar.common.AppSystemInfo.(AppSystemInfo.kt:30)
at ai.platon.pulsar.protocol.browser.driver.LoadingWebDriverPool.shouldCreateWebDriver(LoadingWebDriverPool.kt:370)
at ai.platon.pulsar.protocol.browser.driver.LoadingWebDriverPool.resourceSafeCreateDriverIfNecessary(LoadingWebDriverPool.kt:334)
at ai.platon.pulsar.protocol.browser.driver.LoadingWebDriverPool.pollWebDriver(LoadingWebDriverPool.kt:314)
at ai.platon.pulsar.protocol.browser.driver.LoadingWebDriverPool.poll(LoadingWebDriverPool.kt:202)
at ai.platon.pulsar.protocol.browser.driver.LoadingWebDriverPool.poll(LoadingWebDriverPool.kt:197)
at ai.platon.pulsar.protocol.browser.driver.LoadingWebDriverPool.pollWithEvents(LoadingWebDriverPool.kt:304)
at ai.platon.pulsar.protocol.browser.driver.LoadingWebDriverPool.poll(LoadingWebDriverPool.kt:224)
at ai.platon.pulsar.protocol.browser.driver.WebDriverPoolManager.runWithDriverPool(WebDriverPoolManager.kt:493)
at ai.platon.pulsar.protocol.browser.driver.WebDriverPoolManager.access$runWithDriverPool(WebDriverPoolManager.kt:32)
at ai.platon.pulsar.protocol.browser.driver.WebDriverPoolManager$runWithDriverPool$2.invokeSuspend(WebDriverPoolManager.kt:461)
at ai.platon.pulsar.protocol.browser.driver.WebDriverPoolManager$runWithDriverPool$2.invoke(WebDriverPoolManager.kt)
at ai.platon.pulsar.protocol.browser.driver.WebDriverPoolManager$runWithDriverPool$2.invoke(WebDriverPoolManager.kt)
at ai.platon.pulsar.common.PreemptChannelSupport.whenNormalDeferred(PreemptChannelSupport.kt:58)
at ai.platon.pulsar.protocol.browser.driver.WebDriverPoolManager.runWithDriverPool(WebDriverPoolManager.kt:449)
at ai.platon.pulsar.protocol.browser.driver.WebDriverPoolManager.doRun(WebDriverPoolManager.kt:398)
at ai.platon.pulsar.protocol.browser.driver.WebDriverPoolManager.run(WebDriverPoolManager.kt:157)
at ai.platon.pulsar.protocol.browser.driver.WebDriverPoolManager.run(WebDriverPoolManager.kt:137)
at ai.platon.pulsar.protocol.browser.emulator.context.WebDriverContext.run(WebDriverContext.kt:77)
at ai.platon.pulsar.protocol.browser.emulator.context.BrowserPrivacyContext.doRun$suspendImpl(BrowserPrivacyContext.kt:69)
at ai.platon.pulsar.protocol.browser.emulator.context.BrowserPrivacyContext.doRun(BrowserPrivacyContext.kt)
at ai.platon.pulsar.crawl.fetch.privacy.PrivacyContext.run$suspendImpl(PrivacyContext.kt:287)
at ai.platon.pulsar.crawl.fetch.privacy.PrivacyContext.run(PrivacyContext.kt)
at ai.platon.pulsar.protocol.browser.emulator.context.BasicPrivacyContextManager.run1(BasicPrivacyContextManager.kt:92)
at ai.platon.pulsar.protocol.browser.emulator.context.BasicPrivacyContextManager.run0(BasicPrivacyContextManager.kt:80)
at ai.platon.pulsar.protocol.browser.emulator.context.BasicPrivacyContextManager.run(BasicPrivacyContextManager.kt:34)
at ai.platon.pulsar.protocol.browser.emulator.impl.BrowserEmulatedFetcherImpl.fetchTaskDeferred(BrowserEmulatedFetcherImpl.kt:93)
at ai.platon.pulsar.protocol.browser.emulator.impl.BrowserEmulatedFetcherImpl.fetchContentDeferred$suspendImpl(BrowserEmulatedFetcherImpl.kt:80)
at ai.platon.pulsar.protocol.browser.emulator.impl.BrowserEmulatedFetcherImpl.fetchContentDeferred(BrowserEmulatedFetcherImpl.kt)
at ai.platon.pulsar.protocol.browser.emulator.impl.BrowserEmulatedFetcherImpl$fetchContent$1.invokeSuspend(BrowserEmulatedFetcherImpl.kt:57)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at ai.platon.pulsar.protocol.browser.emulator.impl.BrowserEmulatedFetcherImpl.fetchContent(BrowserEmulatedFetcherImpl.kt:56)
at ai.platon.pulsar.protocol.browser.BrowserEmulatorProtocol.getResponse(BrowserEmulatorProtocol.kt:43)
at ai.platon.pulsar.crawl.protocol.http.AbstractHttpProtocol.getProtocolOutputWithRetry(AbstractHttpProtocol.kt:118)
at ai.platon.pulsar.crawl.protocol.http.AbstractHttpProtocol.getProtocolOutput(AbstractHttpProtocol.kt:88)
at ai.platon.pulsar.crawl.component.FetchComponent.fetchContent0(FetchComponent.kt:108)
at ai.platon.pulsar.crawl.component.FetchComponent.fetchContent(FetchComponent.kt:75)
at ai.platon.pulsar.crawl.component.LoadComponent.fetchContent(LoadComponent.kt:505)
at ai.platon.pulsar.crawl.component.LoadComponent.fetchContentIfNecessary(LoadComponent.kt:266)
at ai.platon.pulsar.crawl.component.LoadComponent.load1(LoadComponent.kt:233)
at ai.platon.pulsar.crawl.component.LoadComponent.load0(LoadComponent.kt:227)
at ai.platon.pulsar.crawl.component.LoadComponent.loadWithRetry(LoadComponent.kt:129)
at ai.platon.pulsar.crawl.component.LoadComponent.load(LoadComponent.kt:117)
at ai.platon.pulsar.context.support.AbstractPulsarContext.load(AbstractPulsarContext.kt:367)
at ai.platon.pulsar.session.AbstractPulsarSession.loadAndCache(AbstractPulsarSession.kt:493)
at ai.platon.pulsar.session.AbstractPulsarSession.load(AbstractPulsarSession.kt:184)
at ai.platon.pulsar.session.AbstractPulsarSession.load(AbstractPulsarSession.kt:171)
at ai.platon.pulsar.session.AbstractPulsarSession.load(AbstractPulsarSession.kt:169)
at ai.platon.pulsar.examples._0_BasicUsageKt.main(_0_BasicUsage.kt:17)
at ai.platon.pulsar.examples._0_BasicUsageKt.main(_0_BasicUsage.kt)

@galaxyeye
Copy link
Collaborator Author

The issue is suppressed on 1.10.x by disabling OSHI, we will try to fix it on 1.12.x. This occurs only on Windows which is not assumed to be product environment, so it's OK to just disable OSHI component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant