Cygwin in a Production Environment?
not-so-anonymous Anonymous Coward asks: "I'm working for a company that does all of its programming and script development in a Unix environment (90% of our work is either Bash or Perl scripts that communicate with an Oracle database). We've recently gotten a new customer and for reasons beyond our control, the server must be a Windows box. Since we want to reuse our existing scripts that we've spent a considerable amount of time developing, we're looking into Cygwin as an option. Has anyone run Cygwin in a production server environment for any extended period of time? If so, what were your experiences with it?"
We have been using cygwin dll to run RSYNC on Windows servers without any issues.
Consensus is good, but informed dictatorship is better
cygwin is a really nice emulation layer, but it is an emulation layer and is not 24x7 ready. The timekeeping and IPC mechnisms aren't fully reliable for production-ready use, IMHO. It is amazing for what it does.
We've been running several production PostgreSQL-on-cygwin servers and have been experiencing random corruption and poor timekeeping. There's a bug (hopefully fixed now) in cygwin timekeeping that causes a rollover after 49 days of uptime. PostgreSQL on cygwin also experiences odd table and index corruption problems that I've never seen with it on Linux/FreeBSD.
We're cutting to Oracle for business reasons, or we'd switch to the newly free Win32 PostgreSQL ASAP.
Have you considered MS' Services for Unix? We've not used it, but I'd be interested in hearing about how well it works.
- Barrie
If you're just running shell scripts, you're probably going to be able to make the transition with a minimum of effort. Cygwin is a bit slow, though. It's good for most purposes, but don't depend on it to do more than administrative tasks.
At least, in my experience. I use it for development and it makes my life livable.
Services For Unix is now free.
...I remember when that was just a Windows bug...
No matter how well Cygwin works out, you still have to run Windows under it. Doesn't sound very "production server environment" ready to me.
The main downside is that you get an exe with a perl intepreter in it. If you have more than one script to build, get the pro versionand compile them with the -small option. That will build a dll which contains the interpreter, and the compiled exes link to it.
As far as your shell scripts, I'm not sure. I've run scripts under Cygwin, but they weren't very complicated and so I wouldn't know much about reliabilty or performance.
-B
Ash and Hickory, straight-grained and true, make excellent bludgeons, dandy for the cudgeling of vegetarians.
If you use cygwin, make sure to get a better terminal for it. Puttycyg uses Putty's great terminal emulator for cygwin, and it works rather well.
http://home.wanadoo.nl/fvu/Projects/Bash/Web/bash. htm bash & windows faq/howto thingy and perl on windows google search .
world was created 5 seconds before this post as it is.
I would recommend you use ActiveState's Perl distribution in conjuction with the Cygwin enbvironment.
It's reasonably prioed and well supported, without a lot of stuff you *don't* need thrown in.
The difference between stupidity and genius is that genius has its limits.
I use Cygwin all the time, and I would say that it doesn't feel quite solid enough for production. The only long-lived processes I run in cygwin are xinetd and sshd, and I've occasionally seen sshd crap out. On the other hand, I've been using it daily for 8-10 months to run a CVS repository and several clients, and not had one problem with that.
.exe, and use some other mechanism for storing symlinks (NTFS reparse points maybe), that would help greatly.
It could be that my poor impressions of reliability are based on older versions (I've been using it since B19 or so) or a few buggy packages. Most of the weird errors I've seen are due to Cygwin's filesystem games; if they would stop trying to name executables
I don't use Perl much myself, but one-liners generally work as expected. A surprising number of Unix scripts and programs work without any changes under Cygwin; why not just set up an instance of your software on it, and see what happens?
Java: the COBOL of the new millenium.
Cygwin is an integral part of a remotely managed windows-based touchscreen information network we've deployed across Scotland. It's been running without issue for almost two years now, on about 30 WinXP machines. In fact, just about everything else has gone wrong throughout this time thanks to viruses and shoddy supplied hardware, but Cygwin quietly does it's (admittedly simple) job.
What about the possibility of either running Linux inside VMWare on a Windows machine or the reverse?
Admission: I don't have recent direct experience with VMWare myself; it used to be that the two systems needed different IP addresses, but I don't know if that would keep within the constraints your customer wants to impose.
[My two cents: the constraint sounds overly artificial. A network-presence appliance that's secure and does its job is good enough for most people. Think of network printers, for example. It's not like every single active IP presence is going to need a Windows XP update...
Finally, I've heard some people express a preference for MinGW over Cygwin for some reason...
"Provided by the management for your protection."
Use VMware or Virtual PC (Virtual PC is from Microsoft, too! so they should be happy) and run whatever unix OS you're using inside Virtual PC (or VMware) and you're happy and they're happy.
I dunno about CGYWIN, i wouldn't trust it....
You can tell how powerful someone is by the magnitude of the crime they can commit and be able to get away with.
However, in a larger context:
Uhhh, you are taking on a customer for whom you have no tools and no infrastructure for? Who doesn't fit your current model, and fundamentally doesn't fit how you do business? Unless you are laying the ground work to bring in lots more revenue at a lower cost in the future, this might be stupid to do.
Now, a company has to grow, but remember the princepal that says, "Not all customers are profitable". You don't want customers who don't make you money. I remember a story about an advertising company that eliminated 70% of their existing customers and have revenue plumet, but their profits jumped by 30% (as a dollar value, not as a percentage of revenue, they made 2.5Mil instead of 1.5Mil in profit, I believe revenue went from 30Mil to 12Mil).
I know on more then on occasion, the smartest thing the guys in charge where I work is to fire customers. Some customers aren't worth the time or the trouble to deliver service to.
This isn't an anti-Window post, it's merely a matter of considering weather or not this is an area you are planning to expand into, or if this is a one-off, non-scalable solution for a single customer just to get the business.
We run into this quite often, around it's driven by sales people whose sales goals are about bringing in revenue, not bringing in profit. If it costs us $1000 in to bring in $500 in revenue, that's a stupid business proposition. If it's a big chunk of revenue, and you can build it while making money go for it.
Kirby
Under Windows XP only, cygwin dll has a problem with locking threads after they have terminated.
;do
If you spawn a bunch of processes (such as in a common loop), each of those will use up at least 1 TID. Any call to create new threads made through the cygwin dll makes that TID non-reusable in windows, and will eventually crash your box.
Shell Script that crashes your box:
integer i=70000
while ((i -= 1))
echo hello\\nworld | cat|cat|cat|grep h >&- #spawn some processes
done
While cygwin has its problems, I've had many more w/ Services for UNIX
I work for a relatively large Credit Union and we currently run CYGWIN on many of our production servers to communicate with our UNISYS host. It's running in a 24x7 environment and has given us no problems. We do restart the web hosting services once a night (mostly to change log files).
We use it to interface with both Oracle and MSSQL databases. Again we have found little to no problems at all running on production hosts.
If you will need to run Apache 1.3 under Cygwin, watch out for the path traversal expoloit. It supposedly only shows up under Cygwin but you can work around it by setting filesystem permissions carefully.
They always did the trick for me...
One problem I've noticed using cygwin as a development environment with a bunch of Windoze programmers is that cygwin is more particular bout the permissions on the files than the Windoze double-click. That is, cygwin needs the executable bit set, where Windoze doesn't care. This can be frustrating when you have scripts calling other scripts and the permissions are wrong somewhere deep in the heirarchy.
While this might not affect you if you are setting up the directories yourself, it might bite you if your customer uses the mouse to copy new scripts into the directories from a non-cygwin environment.
Religion is poison to rationality, and we lose sight of that at our own peril. -- Lurker2288
I use Cygwin to run under Windows a rather complex apllication that is developed under Linux.
Everything goes well, but there are some small thing to notice:
- the performance usually is comparable to that on Unix. Sometimes I get the impression that the network operations are a bit slower (just an impression, but it repeats itself)
- some libraries/applications may need shared memory: configuring the ipc-daemon (or cygsrv), which provide IPC share memory, is sometimes rather tricky. Once they are configured, they work without problems.
- sometimes you get a weird remap error when trying to link or load some libraries. There you have to use the rebaseall utility, which will fix the conflicting addresses
- Cygwin comes with X windows, which can greatly simplify your life.
- The default Cygwin shell is ugly and lacks many capabilities: it is better to install rxvt (which does not need to have X installed) to have a very Unix compatible terminal.
I highly recommend that you use Interix
c ontri b/samples/codesnippets/oracle-ksh-access.shar
(www.microsoft.com/windows/sfu/) instead
of GNU cygwin, and ksh instead of GNU bash.
For connecting to Oracle from ksh using
co-routines, a feature which bash doesn't
have (besides ksh using _less_ memory and
being _much_ faster on string ops), see
https://MirBSD.BSDadvocacy.org:8890/cvs.cgi/
For a portable version of a highly modern
pdksh derivate, the project has released
http://wiki.mirbsd.de/MirbsdKsh - it works
under Interix with no patches.
My Karma isn't excellent, damn it! (And
If you're using a fair bit of Perl on windows you probably want to use Active state Perl. It's pretty nice, and you'll have no problem installing pretty much any module you'll need. If your scripts are written well (i.e. not doing platform specific system calls) then porting will be almost a non-issue.
At one of my clients, there are about 9 solaris servers that run headless, but have a few applications that are X based. All of the windows servers are hooked up to a KVM, so I put cygwin on one of the windows boxes, set it up to auto-login and start the X server (prodiving you are at the console, and not thorugh terminal services) and start acceptings connections from the defined servers.
Not quite the same situation as yours, but I think if it can handle running an X server (stable, for the past several months) it should be able to handle some bash/perl scripts.
Good luck.
while true ; do echo this is my sig; done
For most intents and purposes (all that I've come across), cygwin is effectively seamless, and is at least as reliable as Windows is.
Obviously, though, you should take an intelligent approach. Some things don't make much sense to run under cygwin. cron comes to mind. It's available, but if you want it to be a little more integrated, I'd invest a little bit of effort to get those things that need to be cronned running as a windows service or under task scheduler or something native to Windows. Not only will it be more efficient and more intuitive for the Windows admin, it may be more reliable too. There are plenty of other examples too, I'm sure.
Anyway, cygwin will have no trouble at all handling the scripts, but I don't think simply dropping everything into a cygwin installation is the nicest way to go. Put a little effort into it and cygwin will serve you well for the rest.
Random and weird software I've written.
I tried numerous times today to scp a 1MB file from an XP box running the current version of Cygwin to a Linux box (#1) with the most recent OpenSSH.
It would xfer a random amount (0-43%) and hang every time I tried.
I finally ended up using Linux's SMB mounting capability to access the file and used the Linux box (#2) to scp the file - no problem.
The XP box and 2nd Linux box mentioned are on the same network, the 1st Linux box (that I was trying to scp to) was on another network many hops away.
I have no idea why it would hang every time, but I went to check the installed version using Cygwin's setup tool and it said openssh and openssl were both current.
Tell you what... install the software on Linux and provide the customer with the BSOD screen-saver, they'll think they got MS-Windows.
- Preferences: Solaris 10 (servers), Ubuntu (desktops), Solaris 11 (personal servers) -
i have a similar issue: i have some semi-RT apps that were written by a vendor for ;-),
WinNT(and XP) - and not having tried either(i'm an end-user, not an admin, so i can't tinker...
there ought to be a good way to utilise one or the other to achieve acceptable results in a
production environment.
before anyone gets all huffy about XP, it is fairly stable, can be configured to be relatively
secure(!) and, a recent LinuxFormat Magazine had a co-linux/Gentoo dist on it.
anyone try either one out? philosophically, i'd prefer to use win4lin, but realise that it may be
more practical to try co-linux because of the peculiarities of XP(wierd system calls, etc.)
"...that's as white as it gets; all the bits are on..."
I already made a post in a thread about SFU that was looking like (disclaimer: i love cygwin):
Now bout your particular problem (prod env, 24x7), I've experienced very few problems running CygWin in such an environment. I use it since at least 5 years (I remember downloading it at 56k, so it's probably more), but there's some things you need to be aware with cygwin:
<Job ID="MyJobID">
<script language=PerlScript>
#
</script
-- search the web
IBM/Tivoli used cygwin all over the place in older versions of the Tivoli Management Framework & Monitoring. It works great.
If cygwin is not upto production standard, then maybe you can evaluate Unix for Windows - it was originally an ATT labs product - but now seems to have been sold. You can download a non-commercial version for free (as in beer). Check it out at http://www.research.att.com/sw/tools/uwin .
If you can get past the horrible, horrible installation, Cygwin is a pretty nifty piece of kit.
However, in a commercial environment there is one tremendous downfall to using Cygwin. The Cygwin.dll library that does all of the translation from Unix to Windows system calls is under the GPL. NOT the LGPL. This means that if you write an application and build it against the Cygwin libraries and plan to distribute it, the only license you can legally put your software under is the GPL. This is the only case of the "virulent" nature of the GPL that we've witnessed firsthand and I must say it is a particularly nasty one.
For more info:
read the FAQ.
This is the same bug that occurs in native Windows 95, I believe. I think it's fixed in newer Cygwin DLLs.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
Cygwin basically adds a nice layer of POSIX functionality to the Win32 subsystem. (Don't even mention "Windows has POSIX" -- it's a seperate subsystem, it's broken and incomplete and not going to be fixed, MS just added enough to be able to say to the US government "yes, NT is POSIX" with a straight face, so that they qualify for defense contracts.)
It also adds bunch of other things (mount points, IPC, etc), but the POSIX/*nix features are the main part of the DLL.
The downside to the layer is that it's very slow. This is not always Cygwin's fault; some of the Win32 calls that have to be used to get correct Cygwin behavior are slower'n hell. One of our customers uses a GCC hosted on Cygwin, and it spends a lot of time in the Win32 code, just waiting.
The MinGW system is the same idea, but without the special DLL, without the layer, and therefore using only the features offered by native Windows. A lot of nice stuff is unvailable that way, but it's faster. After moving the customer's GCC to be MinGW-hosted instead, they reported serious speedups.
(There's also MSys, which is MinGW plus some other stuff; I'm not really sure what it does. It's all explained on their website.)
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
I had some problems with inodes not being unique in earlier versions of cygwin (this caused problems in a very large "make"). This has been mostly fixed though as far as I can tell. The last version a few weeks ago I tried only had 2 non unique inodes in the filesystem for 2 files that were "the same" but stored in different locations.
Other issues are that it's better to do everything in cygwin, or everything in windows rather than mixing the two, as translating the paths from one to the other can cause a lot of annoyance. Personally I'm veering towards the opinion that, at least for what I do, it's better to use native windows versions of the GNU tools if you can find them rather than the cygwin ones.
Re-read the GP's post. This bug has been fixed. So what do you do if you find a different bug? You submit it to the maintainer of the program, and they'll try to fix it. That is the exact same thing you'd do with a closed source product. As for support contracts, if you want one, you can usually find someone who will sell you one.
This post written under Gentoo-linux with an SCO IP license.
Are you sure you want to be considering cygwin for a production environment?
Microsoft has their Services for Unix (SFU) at version 3.5 and is now free for download. I'd say that in a mission-critical environment, SFU is much more rock solid and production-tested than cygwin.
(And if you're going to bash it just because it bears a Microsoft name, just remember that technically it's only sold by Microsoft and developed by someone else).
SFU is great and may be needed in addition, but you can't mix UNIX and Windows executables in your scripts with it. Cygwin allows this. So the SFU shell is more like a VMWare installation than Cygwin, which may reduce the usability of your scripts.
But it depends on what you need.
LedgerSMB: Open source Accounting/ERP
It's not free but there is also MKS http://mkssoftware.com/
I had a similar problem with a customer needing code ported from unix to windows 2000, with some unix specific stuff in the code like forking processes etc. (This was about two years ago)
:)
I looked around for several solutions and came across cygwin, which did the job.
The problem was that at that time it was property of Red Hat [http://www.redhat.de/software/cygwin/support/], who apparently were busy with anything but cygwin. Their website said something about $100.000 or something for a developer license, which was out of the question. Emails I sent were not answered, and i had to abandon the idea.
Similar story with Microsoft. The *one* guy i managed to get hold of wasn't even aware they had a product named Services For Unix. (Hello ?)
Different story with MKS. Unfortunately their toolkit was over-budget too, but at least they were trying to help me, and trying to sell me a product I needed, and very polite and helpful.
(Kudos to miss K.
I hope for their sake they got their act together at Red hat about cygwin now, cause they probably missed an opportunity to make some bucks and more importantly get a foothold in a big japanese electronics company's development division.
I've used Cygwin for years and they'll have to pry it from my cold, dead fingers -- unless they convert to Linux from Windoze. ("They" is anybody that makes me use Windoze on the Desktop but still gives me admin capability to my Windoze box.)
It's pretty stable, but I don't know if I'd trust it for mission-critical work. Again, I don't trust Windoze for mission-critical work, either.
The fact that Cygwin usually runs as an app on top of Windoze and that it usually likes to run in a console window on top of a real desktop makes it less stable and is a non-replacement for Linux/Unix, for sure. I'd take it over MKS or Hummingbird Exceed in a heatbeat, however, for functionality and performance reasons, alone!
It's definitely better than VBA or OLE, for stability and automation of the things it can automate. OTOH, ActiveState Perl is, too, and it can hook into Windoze pretty well. I believe that ActiveState Perl, if you can run your apps on it, would be more stable, but less feature-rich than Cygwin. You may want to use ActiveState Perl, instead.
However, has the author considered this option?
http://www.redhat.com/software/cygwin/
RedHat sells support contracts. Also, the RedHat license for Cygwin is REQUIRED if you commercially distribute cygwin or its apps.
It depends on the application, the cost of being cross-platform, and the potential value of the expanded market.
The likely answer is really that you can't afford to be cross-platform. Good cross-platform development is expensive. It's *not* just a matter of coding everything in (say) MONO/GTK#. You have to have installers for each platform. You have to have documentation for each platform. You have to have support for each platform. You have to have test infrastructure for each platform. It just goes on and on and on.
Therefore, if you have an application that makes sense on Windows, the market for non-Windows versions is so small that it's silly to waste the money and time to be cross-platform. Alternatively, if you have an app that is going to be Unixy, then just get the Unixy one right, and go after that market. Your revenues might not be as large, but I bet your profit margins will be better.
Sure, there are exceptions. But general statements like "you need to be cross-platform" means you probably haven't really thought about your target market and don't have any how much cross-platform really costs. (Just to be clear: running on a few different Unix variants isn't what I'm talking about, although even just that adds a surprising amount of effort.)
We use Cygwin in production environments.
We have been very pleased with the functionality.
But, we have run into one major bug. On hyperthreaded machines or SMP machines the Cygwin1.dll has threading bugs.
These cause random errors, crashes, and hangs.
Since Cygwin is free, and supported by volunteer effort, there isn't any guaranteed support (other than the standard OSS mantra "You have the source, so fix it yourself!")
If you can live without guaranteed support, and understand that there are some bugs, Cygwin is a nice product.
<offtopic> That exact mantra is one of the things wrong with the open source mindset. Not all the users of the product are programmers so they cannot fix it themselves.
Also, of those that ARE programmers how many of them will actually take the time to fix the problem? In my humble opinion, the programmers of the OSS should take the advice to heart and fix the problem! </offtopic>
Instead of running an "emulation layer" (like Cygwin) or a "PC virtulization" (like vmWare), you could be running Linux alongside Windows.
Though it's a young project, I have been playing with it quite a bit, and haven't run into any problems re stability.
It might be faster than Cygwin too.
I am the architect for Tracker, a project funded by the U.S. State Department and deployed in 9 countries.
This is a Java (J2EE) application using JBoss as our application server. We need to develop as well as deploy on Mac OS X, linux (Redhat 9), Solaris 8, and windows XP.
We use Cygwin on windows in both development and deployment environments, so that all of our scripts (administrative, start, stop, build, etc) are completely cross platform. Works like a champ. No complaints in production at all, although their installer interface seems a little wierd to me. It would be really useful if I could get some kind of report stting the exact configuration of a machine.
I don't use Cygwin for production work. That doesn't mean it wouldn't be useful in that capacity, I just haven't found the right employer for that type of work.
I use it as a way to take Windows 2000 (let's face it, a stable but not secure, OS) and make it almost as smart as Unix. I'm a command line, vi loving, Perl programming geek and I've essentially eliminated 98% of all differences between a Linux/Unix platform and Windows. I hate dual booting.
I can use the best of Windows and the best of Unix with little drawback on either end. I use VirtuaWin to get multiple desktops and the Cygwin/GNU tools to make the Windows OS capable of doing hard work.
I prefer the Windows' GUI to KDE, Gnome, etc. because it's clean and I don't do too much customization anyway.
Cygwin is the most important piece of software I use.
~
~
It's free as in beer and performs a lot better than Cygwin. MS has special hooks in the kernel for SFU so thinks like piping actually has a reasonable performance (on Cygwin it sucks major ass). Not as fast as running natively on Unix and much much much less reliable but probably a better option.
I normally don't endorse MS products but in this case you'll actually get reasonable vendor support (something you can't really say with Cygwin).
int func(int a);
func((b += 3, b));