23 ms·
Poll on macOS 10.12 is broken
- coldcode 10y agoYet another reason not to ship 4 OSs the same month every year.
- pvdebbe 10y agoFour?! MacOS and iOS I know, what are the other two?
- italophil 10y agotvOS and watchOS
- pvdebbe 10y agoThanks. watchOS I know by name, tvOS is totally new to me. Funny that it has to be its own thing.
- Razengan 10y agoTVs inherently require a different UI and control mechanism than computers or handheld touchscreens. It's more or less a reskin of iOS, pretty nice, and you can cross-compile/cross-purchase iOS/tvOS apps fairly seamlessly. I'm glad Apple chose to develop a different OS for each class of device, unlike say, Microsoft's insistence on the one-size-fits-all approach — it's what made the iPhone popular in the first place.
- philjohn 10y agoThey didn't though, they're all Darwin/XNU underneath the hood, it's just the user interface is different, and some of the userland APIs don't cross over.
- valarauca1 10y ago>TVs inherently require a different UI and control mechanism than computers or handheld touchscreens. It's more or less a reskin of iOS, pretty nice, and you can cross-compile/cross-purchase iOS/tvOS apps fairly seamlessly. This isn't what an OS is. It is about 10 levels of abstraction below this. It handles managing virtual memory, IO, networking, process switching, processor interrupts, threading. All the low level nitty-gritty hardware details you need to worry. These tasks are fairly generic this is why Linux can run on Smart Phones, Laptops, PC's, Watches, and Super Computers.
- umanwizard 10y agoNitpicking about what words mean when it isn't relevant to the substance of the discussion is always annoying -- but it's even worse when you're actually wrong. What you are describing is called a "kernel", which is one important part of an OS. No one (or almost no one) uses "OS" as a synonym for "kernel". Linux is a kernel. Desktop Linux (Ubuntu or whatever) is not the same OS as Android.
- cyphar 10y ago> >TVs inherently require a different UI and control mechanism than computers or handheld touchscreens. It's more or less a reskin of iOS, pretty nice, and you can cross-compile/cross-purchase iOS/tvOS apps fairly seamlessly. > This isn't what an OS is. It is about 10 levels of abstraction below this. It handles managing virtual memory, IO, networking, process switching, processor interrupts, threading. All the low level nitty-gritty hardware details you need to worry. > These tasks are fairly generic this is why Linux can run on Smart Phones, Laptops, PC's, Watches, and Super Computers. You're talking about the kernel Linux, not about an operating system. An example of an operating system is GNU/Linux, which includes much more than just a kernel.
- DaiPlusPlus 10y agoIt isn't. All four OSes share the same kernel and many userland components, just the "shell" is different.
- deleted 10y ago[deleted]
- deleted 10y ago[deleted]
- deleted 10y ago[deleted]
- sotojuan 10y agoNot even that, just don't ship a new OS for your computer every year. I know they're not big changes like say, Windows 98 -> XP, but still.
- wil421 10y agoExactly, I'm all for more frequent releases but a yearly one is too frequent. I'd rather have stable features than UI/UX changes every year. Windows is doing the same. It might make sense on mobile since features and abilities are changing rapidly. For desktop, I'd take stability over new features yearly.
- melling 10y agoYeah, Tim Cook and Jony Ive can't possibly have enough time to thoroughly test everything. Why do people wait for things to go wrong then make blanket statements about a "better way"?
- hellofunk 10y agoRight, because they are doing all the testing themselves.
- AdamGibbins 10y agoI believe that was sarcasm. It seems unlikely in an organisation of Apple's size that its the same people doing the release/testing processes for all 4 operating systems.
- deleted 10y ago[deleted]
- blinkingled 10y agoThe poll system call is very likely the same exact implementation for all 4 though. If it was a bug in platform specific code then you'd have a point. It's not like they are shipping 4 complete rewrites.
- valarauca1 10y agoAgreed MacOS/OSX, iOS, WatchOS, and TVOS all are user-land modifications of Darwin/XNU (Next-OS kernel), which is a modification of Mach (BSD-like research kernel).
- DerekL 10y agoI don't have macOS 10.12 installed, so I couldn't test it. But I put their test code into an iOS app, and the bug does occur on iOS 10.0.2, on an iPhone 7.
- Keyframe 10y agoLots of stuff on macOS gone weird / mental. Try to set thread affinity, for example. Look at their source in /usr/include/mach/thread_policy.h under thread_policy_set and thread_policy_get
- valarauca1 10y agoLots of stuff on macOS gone weird / mental. Try to allocate large blocks of memory in a dynamically loaded function. The pointer you get back is a raw non-virtual pointer, then you need to use non-posix calls to map that region into your process's virtual memory space.
- chillaxtian 10y agocould you expound on this? which syscall exactly are you making?
- valarauca1 10y agoPOSIX != SysCalls Libc (or the various other libs that compose libc) are not necessarily system calls, often they are wrappings of severals. I'm talking about the `dlfnc.h` interfaces.
- slrz 10y agoAre you saying that when you call dlsym(3) on OS X you get back a non-null pointer to memory that is not mapped inside your address space? That can't be, right? So where does your "weird" pointer actually come from and how is it connected to the allocation of huge blocks?
- valleyer 10y agoSeconded. Please post a test case that shows this failure.
- duaneb 10y ago
- meelooo 10y agoclicked the link and got "Error establishing a database connection". Not sure I can trust the source ;-).
- mrmagooey 10y agoThis is a common error message for a number of CMS's (in this case probably WordPress) when overloaded, and shouldn't reflect upon the validity of the source.
- jibcage 10y agoMirror anywhere?
- rkcr 10y agoThe page loaded after a while, so I've got you covered with a gist: https://gist.github.com/dlew/781f4bfac391ab1b64ad383c979ac38f https://gist.github.com/dlew/781f4bfac391ab1b64ad383c979ac38...
- davidcollantes 10y agoDo you have an automated way to do this?
- hellofunk 10y agoThe OCaml system no longer works on macOS either, installation is totally wacked out. A fix is being worked on.
- avsm 10y agoDo you have a bug reference for this OCaml issue? It works fine here for me on OSX 10.12.
- hellofunk 10y agoJust tried to track down the details, it looks like I was thinking of an Opam problem specifically, and the last update was about 3 weeks ago, so likely the issue is already resolved.
- tempodox 10y agoThanks for the warning. I put macOS 12 installation on hold for more superficial shortcomings. This one would have taken me a bit longer to find. I have adopted the practise of installing new OS releases on a separate test partition first. Blindly updating the main system can be a really bad trap.
- hellofunk 10y agoJust tried to track down the details, it looks like I was thinking of an Opam problem specifically, and the last update was about 3 weeks ago, so likely the issue is already resolved.
- mappu 10y agoGolang broke on macOS Sierra as well - and since all Go binaries are statically linked, the practical impact is that all compiled binaries stopped working until a compiler update was released. From the Go1.7 release notes: "Binaries built with versions of Go before 1.6.3 will not work correctly on Sierra." I don't know what the underlying cause was.
- nxc18 10y agoIt sure would be nice if macOS worked as well as Apple was promising a few years back. My MBP is so buggy as it is with El Cap that I prefer to use a cheap surface 3 for anything other than dev work. Every time Apple releases a macOS update I'm left to decide between the bugs I already experienced that might be fixed and the mountain of bugs that are surely hidden in the new update.
- wlesieutre 10y agoI used to have a Surface Pro 3 and the wifi on that machine was mental. I know people have been complaining about wifi reliability on Apple's computers for years now, but the Surface was really something else. Every couple of weeks they'd put out a patch that claimed to fix the wifi, and while it did get better, it was never as good as it should have been. I live in a 1-bedroom apartment with an 802.11ac router and all of my other devices work fine. The router's off at one end of the apartment where the coax comes in, but I'm never more than 25 feet away from it.
- stinkytaco 10y agoI had the same issue on my Surface, but Windows 10 basically fixed it. Of course, that was a year after I bought it. I've heard here and talked to a number of professionals that do not use Linux because they want something that "just works". But if I really sit down and catalog my issues, Linux can be a headache to set up, but once it's working I rarely have issues. Part of that is researching the right hardware, so I guess it's not the plug and play of proprietary platforms, but it works.
- wlesieutre 10y agoWifi was definitely better under 10. The random keyboard disconnections on the other hand... those never got fixed. Maybe it was a hardware problem with the magnetic connector and pogo pins. The last piece of productivity software I wanted on Linux was just released recently (Substance Designer), so I'm seriously considering a dual boot. Have to keep Windows around because it's my gaming machine, but I'm a bit sick of having software updates shoved down my throat at inopportune times. What pisses me off the most about W10 is that it makes you pick "active hours" when it won't install updates, but it's a 12 hour maximum and it's the same every day. As if my home computer's usage pattern on Monday-Friday is going to be the same as the weekend.
- Matthias247 10y agoIs this error only happening when the polled set contains no file descriptors at all? I personally would not have guessed that this usage is valid at all, since it would always for the timout. If no timeout is specified there's then even the question if it should wait infinitely (makes no sense but matches the normal poll-without-timeout behavior) or not at all.
- quotemstr 10y agoReturning immediately when nfds==0 is silly: this behavior would introduce a needless discontinuity in the API and requires special-case code in all callers, and all for no benefit. It's like those bad implementations of read_something functions that signal error in the case of reading zero bytes instead of more sanely just doing nothing successfully.
- JdeBP 10y agoIt's subtler than that. It's returning immediately when the number of file descriptors that it fails to add to a kqueue (that is actually going to do the work and that it is setting up) is the same as the total number of file descriptors passed, which it is when they are both zero.
- noselasd 10y agoYes. The timeout is specified, but no file descriptors is given. (so calling poll() behaves like sleep/usleep ). This behavior is explicitly described in posix, worked prior to OSX 10.12, but behaves differently as of OSX10.12
- mikepurvis 10y agoIsn't the distinction that poll/select will only block only the current thread, whereas sleep may block the whole process?
- to3m 10y agosleep blocks the calling thread: http://pubs.opengroup.org/onlinepubs/009695399/functions/sleep.html http://pubs.opengroup.org/onlinepubs/009695399/functions/sle...
- itp 10y agoI can't say I'm surprised. I used to be responsible for the port and upkeep of a relatively low level product to OS X. It was far and away the most troublesome platform. We would frequently run into bugs that had been reported on openradar for years without having been addressed. Off hand I remember spending the better part of two days trying to understand a bug that was traced to a coroutine issue -- OS X was just not saving a required register, known and reported for 5 major versions. I remember discovering that unnamed semaphores don't work on OS X. Not that the functions aren't implemented, just that they always return an error. So I'm not surprised that poll() would be broken, nor am I surprised that it's broken again. The only thing that surprised me anymore is how many people continue to insist to me that OS X (or macOS now, I guess) is a great UNIX. It may be a great desktop OS.
- tpush 10y ago"I remember discovering that unnamed semaphores don't work on OS X" Yeah, Posix semaphores don't work on macOS. Confusingly, support for unnamed semaphores exists however in Apple's libdispatch, using dispatch_semaphore_t. Don't ask me why.
- valleyer 10y agoYup. dispatch_semaphore_t uses Mach semaphores under the cover. (Totally separate from POSIX semaphores.)
- gpderetta 10y agoThe worst part is that sometimes in the past OSX had actually passed Unix conformance. It only shows that those conformance tests are worth nothing. edit: iOS->OSX
- deleted 10y ago[deleted]
- coldpie 10y agoOne of our devs also found that getdirentries returns a bogus too-large value when given a buffer much larger than needed to store the actual data on return, and fills the remainder of the buffer with 0. This caused an infinite loop in our code, as we continually processed empty strings. This behavior is new in 10.12.
- gre 10y agogetdirentries() is deprecated as of 10.6 because it doesn't work with 64-bit inodes, according to the man page. The manpage recommends using readdir().
- blinkingled 10y agoWelcome to Apple QA. Where system call return values are worthless and radar reports don't matter!
- pmontra 10y agoNo unit tests on syscalls at Apple?
- tempodox 10y ago... or even regression tests.
- raverbashing 10y agoYou can't unit test a syscall. But it needs to be a regression or integration test (However I can understand people thinking "ah if you're polling nothing then it immediately returns" instead of looking at the spec)
- StreamBright 10y agoLate adopter here. I never update to any new operating system from Apple on any of my devices what I need to use for production up front. I usually wait until I absolutely have to upgrade otherwise something does not work, or if I have evidence that the new OS runs well on the device I am going to install it on. This saved me a lot of headaches in the last 5-10 years. Given Apple's no downgrade once you upgraded attitude with MacOS I would say it is extremely risk to update to any new operating system version. For those who are not familiar, it is not supported to downgrade MacOS by Apple, they upgrade the firmwares many of the devices in your Mac during an upgrade and there is no official downgrade for those. It is possible with hacking, I know, but I would not risk warranty with such a method.
- riskable 10y agoThere's risk both ways... By updating you risk breakage. By not upgrading you risk security issues and increase technical debt (which is a risk amplifier). I'd argue that missing out on security fixes is far more risky than any technical issues you may encounter after an update but I'm a security engineer.
- wila 10y agoApple does supply security updates for older versions of OS X though. Once that stops it really is time to move on.
- StreamBright 10y agoSecurity patches are available for the previous version, the trend is that the previous 2 versions of OS X receive security updates. Would you mind giving me an example of technical debt? I am not sure what you mean by that. Just to confirm, I am not missing out on security fixes at all, I am updated all the way to the latest version with security patches with the previous version of MacOS.
- Tepix 10y agoThere are a ton of security fixes for macOS sierra. These fixes have not been published for older releases of OS X yet. Apple wants people to upgrade.
- mwcampbell 10y agoI wonder why libcurl even bothers with poll on macOS when there's kqueue.
- blinkingled 10y agoLess platform specific code (kqueue is osx/bsd specific IIRC)? And it's not like libcurl needs the scalability of kqueue. Bonus stink - http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#OS_X_AND_DARWIN_BUGS http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#OS_X_AN... - kqueue has been buggy and Apple switched poll to use kqueue in 10.5.6!
- eridius 10y agoThat page doesn't explain why it says kqueue is buggy. All it says is > most versions support only sockets, many support pipes That seems to be self-contradictory, especially because elsewhere in the document it says > usually it doesn't work reliably with anything but sockets and pipes, except on Darwin, where of course it's completely useless But nowhere on that page can I find an explanation of what's actually wrong with it.
- blinkingled 10y agoYou can find many bug reports referencing OS X kqueue brokenness - however if you want to get to the details of what's wrong with kqueue impl on OS X - you will have to do that yourself - test out various use cases, look at libev source code and try to get it to use kqueue on various OS X versions, get it to pass all tests - iow lot of work. It seems to be acquired wisdom to ignore kqueue on OS X for many OSS projects. As this thread also shows it (poll which use kq) worked on previous version but broke on Sierra which alone seems to be enough to ignore it. Here is a thread with sample code having kqueue issues - https://discussions.apple.com/thread/4783301?tstart=0 https://discussions.apple.com/thread/4783301?tstart=0 (Note: I haven't seen that code myself - it might as well be buggy itself but you can use it for your tests as a starting point I suppose.) Edit: User DerekL also reports running code that illustrates the bug on latest iOS version - https://news.ycombinator.com/item?id=12687527 https://news.ycombinator.com/item?id=12687527
- tim333 10y agocache: http://webcache.googleusercontent.com/search?q=cache:ByQB7vdOuhgJ:https://daniel.haxx.se/blog/2016/10/11/poll-on-mac-10-12-is-broken/&num=1&hl=en&gl=uk&strip=1&vwsrc=0 http://webcache.googleusercontent.com/search?q=cache:ByQB7vd...
- slyrus 10y agoI saw the headline and thought: "Definitely voting yes on that poll!" but then I realized it said something else. Still...
- ankurdhama 10y agoIn the specs of the poll function I don't find anything that says if you pass NULL as the fds then also it will wait for specified timeout. Am I missing something? "If none of the defined events have occurred on any selected file descriptor" - This statement is not same as passing NULL.
- groovy2shoes 10y agoPassing NULL is treated like passing an empty fd set. If there are no file descriptors to check, then "none of the defined events have occurred on any selected file descriptor" is trivially true. The same would hold for non-empty fd set and no defined events, I'd imagine.
- Redoubts 10y agoYou could also say that all of the defined events occurred.
- groovy2shoes 10y agoFor the "no defined events" case, that logic is sound. I can't imagine it being particularly useful behavior, though.
- ankurdhama 10y agoIt is kind of tricky to define this situation formally. Much like if a statement says "Given a list of numbers" than does empty list denotes a list of numbers? There are arguments for both - yes it does and no it doesn't - but the only way to select any one argument over other without conflict depends on additional constraints in the definition like saying "Given a list of numbers where the minimum length of list is 1".
- groovy2shoes 10y agoIf it is an empty list of numbers, then sure, it denotes a list of numbers. Luckily, we have type systems that enable us to tell empty lists apart :)
- qwertyuiop924 10y agoWow. I mean, wow Apple. I come from linux, I'm used to screwed up APIs, and stuff breaking. But when we have something broken, it's usually because it was designed that way (see epoll). Usually, anyways. But even we would never break something this fundamental. And if it did break, we'd probably fix it. Immediately. Breaking one of the most used syscalls in the POSIX spec isn't an option, and is never okay. Ever.
- rwmj 10y agoIn released products, no. In development kernels it's a bit more like the wild west. It was only a few years ago that dup3(2) was broken in a development kernel. That's a very fundamental syscall, especially when you consider that some libraries replace all dup2 with dup3 to get O_CLOEXEC behaviour. Of course these things get fixed very rapidly, so completely unlike this Apple/poll story.
- qwertyuiop924 10y agoWell, of course things will break in development, that's to be expected. But once it's been released...
- rwmj 10y agoI was perhaps being stary-eyed and naive, but I expected that Linux would have a comprehensive test suite which would catch this sort of thing, at least for the most common syscalls.
- qwertyuiop924 10y agoI assume that they at least test, and may even test before integrating, but when things are merged into HEAD, changes in various subsystems might affect one another, or some such.
- athenot 10y agoIt's a similar situation: macOS has kqueue. But in this case, they are using poll as the time-honored way to sleep. Yes Apple should follow the expected POSIX behavior but at the same time if sleep is what is desired, there's usleep(3) and nanosleep(2) which are found in libc's time.h
- bangonkeyboard 10y ago10.12's poll() is also newly broken in another way. When called with certain combinations of descriptors, it will block forever, causing an application hang: https://github.com/mpv-player/mpv/issues/3530#issuecomment-250045418 https://github.com/mpv-player/mpv/issues/3530#issuecomment-2...
- BillyParadise 10y agoI misread it. I thought this was a poll on whether Sierra was broken. My vote All I know is I'm getting 50% less battery time this week. Oh, and sqllite-ruby seems to be a bit grumpy.
- torrey_braman 10y agoThought we were going to vote on whether or not we agree that macOS is broken.. I was ready to vote for "Yes". =/
- Esau 10y ago"poll() is defined by POSIX and The Single Unix Specification" This makes me wonder if Apple really earned the Unix certification. If it didn't, then the Open Group should be ashamed.
- tofupup 10y agoneat