drogon icon indicating copy to clipboard operation
drogon copied to clipboard

Add support for Solaris

Open vedranmiletic opened this issue 5 years ago • 18 comments

Tested on illumos distribution OmniOS Community Edition.

Not sure if we care about this (I don't use Solaris in production), but I wanted to learn more about portability so I did the porting.

vedranmiletic avatar Jun 09 '20 15:06 vedranmiletic

It requires an-tao/trantor#94 for the tests to pass. I also verified that the tests still pass on Linux and FreeBSD after these changes.

vedranmiletic avatar Jun 09 '20 15:06 vedranmiletic

I’ll make some sanity checks on macOS tomorrow.

rbugajewski avatar Jun 09 '20 16:06 rbugajewski

@vedranmiletic the drogon_ctl -v command doesn't work after this PR, please check it. I guess you renamed the version class to drogonVersion for avoiding name conflict, please use namespace for this. And please try to keep drogon_ctl help command consistent with before.

You're indeed correct, I should have been more careful and checked drogon_ctl alongside tests. Anyway, I fixed it with a namespace as you suggested.

vedranmiletic avatar Jun 09 '20 21:06 vedranmiletic

I have no idea why PostgreSQL failed in Travis on Linux. Any pointers are welcome.

vedranmiletic avatar Jun 09 '20 21:06 vedranmiletic

Wait, I figured now I should also run test.sh locally. Luckily, on Linux and FreeBSD it still works after applying this patch, but note that I don't have PostgreSQL and MySQL set up for testing.

However, on Solaris webapp_test blocks indefinitely on a future get() and WebSocket test assert fails. So give me a few days to investigate if this is easily fixable.

Do you maybe want to merge this as "Fix building and tests on Solaris" and then I can make a separate patch for the rest?

vedranmiletic avatar Jun 09 '20 22:06 vedranmiletic

@vedranmiletic When a patch fails the existing test, I prefer not to merge it. I think you can create a port/solaris branch on this repository (instead of on your forked repo), you now have this permission. Thanks for your work. I'll help if I can.

an-tao avatar Jun 10 '20 02:06 an-tao

@vedranmiletic When a patch fails the existing test, I prefer not to merge it. I think you can create a port/solaris branch on this repository (instead of on your forked repo), you now have this permission.

Makes sense. I don't have time today to resume working on this, but I will later this week. I first need to figure out why get() hangs, hopefully it's something simple. This is a good chance to understand how various parts of Drogon work together.

Thanks for your work. I'll help if I can.

You are very welcome to try installing OpenIndiana in VirtualBox or VMware. IIRC it had some issue with weird keyboard keys being repeatedly pressed when running under KVM/QEMU.

vedranmiletic avatar Jun 10 '20 08:06 vedranmiletic

@vedranmiletic I compiled and tested drogon on OmniOS, and I found that errors are in the trantor library. The reading and writing on a TCP connection don't work. I'll try to figure it out.

an-tao avatar Jun 10 '20 12:06 an-tao

@vedranmiletic I know what's wrong with trantor now. The IO multiplexer (epoll on linux and kqueue on macOS or FreeBSD) is different on solaris, the change you made just implement a kqueue poller without any functionality, so it can't work.

It seems that poll() is used on solaris, you could find the wapper of poll() in very early version of trantor (before kqueue was introdued into trantor), but I don't know if it is compatible with solaris. poll() on linux is slower than epoll(), I don’t know if it is also inefficient on solaris. I'm afraid there is a lot of work to be done for solaris.

an-tao avatar Jun 10 '20 13:06 an-tao

@an-tao Indeed, in trantor/net/inner/Poller.cc there's a piece of code:

#if defined __linux__ || defined _WIN32
    return new EpollPoller(loop);
#else
    return new KQueue(loop);
#endif

OK, I'll see what I can do.

vedranmiletic avatar Jun 10 '20 16:06 vedranmiletic

@vedranmiletic

commit 49c6311642f38070d34dd1a4f0408f8f41a5ebfc
Merge: 4dade42 c611b9f
Author: an-tao <[email protected]>
Date:   Wed Dec 19 13:50:17 2018 +0800

    Merge pull request #5 from an-tao/kqueue
    
    Use kqueue instead of poll in MacOS/BSD

commit c611b9fc86d8894d2254694926c0354f0f1769e1
Author: antao <[email protected]>
Date:   Wed Dec 19 13:45:23 2018 +0800

    Use kqueue instead of poll in MacOS/BSD

commit 4dade42572b5fc053b4dbe21eede15d5b0f55197

see the git log, Following are the files in the trantor/net/inner/poller folder of the 4dade42572b5fc053b4dbe21eede15d5b0f55197 commit:

4805  6 11 00:16 EpollPoller.cc
  843  6 11 00:16 EpollPoller.h
4198  6 11 00:16 PollPoller.cc
1058  6 11 00:16 PollPoller.h

you could checkout the deleted PollPoller.cc from old version of trantor, and then:

#if defined __linux__ || defined _WIN32
    return new EpollPoller(loop);
#elsdef __sun
    return new PollPoller(loop);
#else
    return new KQueue(loop);
#endif

an-tao avatar Jun 10 '20 16:06 an-tao

@vedranmiletic

commit 49c6311642f38070d34dd1a4f0408f8f41a5ebfc
Merge: 4dade42 c611b9f
Author: an-tao <[email protected]>
Date:   Wed Dec 19 13:50:17 2018 +0800

    Merge pull request #5 from an-tao/kqueue
    
    Use kqueue instead of poll in MacOS/BSD

commit c611b9fc86d8894d2254694926c0354f0f1769e1
Author: antao <[email protected]>
Date:   Wed Dec 19 13:45:23 2018 +0800

    Use kqueue instead of poll in MacOS/BSD

commit 4dade42572b5fc053b4dbe21eede15d5b0f55197

see the git log, Following are the files in the trantor/net/inner/poller folder of the 4dade42 commit:

4805  6 11 00:16 EpollPoller.cc
  843  6 11 00:16 EpollPoller.h
4198  6 11 00:16 PollPoller.cc
1058  6 11 00:16 PollPoller.h

you could checkout the deleted PollPoller.cc from old version of trantor, and then:

#if defined __linux__ || defined _WIN32
    return new EpollPoller(loop);
#elsdef __sun
    return new PollPoller(loop);
#else
    return new KQueue(loop);
#endif

Thanks, was just looking for that commit. Exactly the approach I had in mind.

vedranmiletic avatar Jun 10 '20 16:06 vedranmiletic

Now that PollPoller is back in, let's see if I can get this working.

vedranmiletic avatar Aug 23 '22 11:08 vedranmiletic

@vedranmiletic Thanks so much for resuming this PR, I have no environment of solaris OS, would you please test this PR on your Solaris host?

an-tao avatar Aug 27 '22 15:08 an-tao

Yes, sure. I'll get back with the results in a few days.

vedranmiletic avatar Aug 27 '22 17:08 vedranmiletic

@vedranmiletic have you tested this? thanks.

an-tao avatar Sep 21 '22 11:09 an-tao

@an-tao I tried. Unfortunately, the machine that I could dedicate to Solaris isn't supported in terms of hardware. Virtual machines had trouble in the past. I will find time in the next few weeks to try on a server that worked well in the past and fix the issues that appear (if any).

vedranmiletic avatar Sep 27 '22 16:09 vedranmiletic

@an-tao I tried. Unfortunately, the machine that I could dedicate to Solaris isn't supported in terms of hardware. Virtual machines had trouble in the past. I will find time in the next few weeks to try on a server that worked well in the past and fix the issues that appear (if any).

Thanks so much for your help!

an-tao avatar Sep 27 '22 16:09 an-tao