login about faq

The following crashes for me:

void crash()
{
    for (int i = 0; i <= 2; ++i)
    {
        CkSocket socket;
        if (socket.UnlockComponent("XXXyourCodeXXX") != true) {
            printf("%s\n", socket.lastErrorText());
            return;
        }
        if (socket.AsyncConnectStart( "blah", 24, true, 1 ) != true) {
            printf("%s\n",socket.lastErrorText());
            return;
        }
        while ((socket.get_AsyncConnectFinished() != true)) {
            socket.SleepMs(1);
        }
    }
}

The exception is thrown somewhere in CkSocket library, in its own thread, at around HostnameResolveIpv6:resolveHostname. The problem appears to be that AsyncConnectStart() spawns its own dns lookup thread, which is not properly shut down on destruction of the CkSocket object. As you can see, I do wait for get_AsyncConnectFinished() to return true before killing the CkSocket. But this function appears to be lying, because it should return false if it owns an outstanding dns lookup thread, which would avoid this crash. Another solution would be to add a Join() or Wait() method to CkSocket, which allowed my program to wait until CkSocket's sub-threads are all done before I delete it. You could also make Close() properly shut down any open child threads.

Probably the best solution is to have get_AsyncConnectFinished() properly report false if there are open threads while also properly killing any open threads on destruction.

asked Sep 28 '12 at 19:40

cowtung's gravatar image

cowtung
6114

There is definitely a problem within Chilkat as you described. I'm working on a solution...

(Sep 29 '12 at 11:27) chilkat ♦♦

Here's the new build that should fix the problem:
http://www.chilkatsoft.com/preRelease/chilkat-9.3.2-x86-vc9.zip

If not, then please let me know..

link

answered Oct 01 '12 at 15:26

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Initial testing successful. Thank you! I'll let you know if anything comes up.

(Oct 01 '12 at 18:38) cowtung

Is that download production ready? If not, do you have an ETA for production ready release of that fix?

(Oct 01 '12 at 20:51) cowtung

I fixed the problem. No changes to your code are required. What operating system, architecture (32-bit / 64-bit), VC++ version (if Windows), etc. do you use? I can provide a new build later this weekend once I know..

link

answered Sep 29 '12 at 14:02

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

VS 2008. I was chosen as the guinea pig for Windows 8 x64, but we only compile to 32-bit. So just VC++ 9.0 / win32 libs would be awesome. Thank you.

(Oct 01 '12 at 14:13) cowtung
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×14
×11
×9
×7
×1

Asked: Sep 28 '12 at 19:40

Seen: 1,510 times

Last updated: Oct 01 '12 at 20:51

powered by OSQA