• leppie (unregistered)

    Is see no WTF here.

    Online table schema update - OK Run query - OK

    Having paranoid network admins with crazy firewall rules - NOT SO OK

  • Dizwell (unregistered)

    Oh, the sensible comment (before my "Frist At Last!" one that has now been deleted!!) was that anyone attempting dynamic DDL in a function/procedure/package/whatever probably deserves all the performance woes heading their way.

    (Says the man who inherited code which drops and creates entire tables by the bucketload for no discernable reason... OK, the reason was: a developer I wouldn't these days let within 100 yards of any database under my control. Just so happened he was my boss at the time...)

  • Patrick (unregistered)

    uh... ping much?

  • Anonymous (unregistered)

    Being able to run alter/update queries against a database does not mean that the database is running. Oh wait, yes it does.

  • anon (unregistered)

    WTF? WTWTF? And what did this have to do with passwords?

  • hikari (cs)

    You'd think the fact that you managed to connect to the RDBMS on the mainframe might be enough of a clue that it was running.

    Although, assuming you're using an established connection, it possibly won't actually notice the drop until you try and do something else. I'd just do something along the lines of "SELECT 1 FROM DUAL;" to get around that though.

  • SuperAnalyst (cs)

    I wouldn't call it a major wtf, but altering a table on the mainframe to check the connection status is a tad extreme!

  • Matt (unregistered)

    Is TRWTF here the use of a try catch in such a manner?

  • Yardik (unregistered)

    Umm for all the people who just commented...

    1. Being able to connect to a database does not mean the MAINFRAME is up, they are likely two different systems. Perhaps the mainframe updates the column in the database to tell it "i'm up!" every so often.

    2. Altering a table to add a column via DDL in production application code is just stupid. That is what release scripts are for.. This code is getting run over and over, whenever someone tries to log in, and throwing an exception when it doesn't work! Schema's don't change every day... update it once and forget about it.

    Captcha: tego .... aren't those the stickers for cell phones?

  • Crazyguy (unregistered) in reply to hikari

    I've actually seen a case where the database server was up and running and actually answered to queries to check whether it was working (simple calculations). When any data was requested the database server hung though.

    Can't remember what was done to fix that (could have been service restart).

  • DBA-boy (unregistered)

    The Real WTF (tm) is that no one is catching WOODEN_TABLE_NOT_FOUND.

  • BSDman (unregistered) in reply to Crazyguy

    Is mainframe up?

    1. ping MainframeName_Here
    2. Host small intranet with PHP page to display info you want, like running services and their status.

    Database != Mainframe. Mainframes MAY run databases but do not imply any relation....?? I'm so confused.

  • dpm (cs) in reply to Patrick
    Patrick:
    uh... ping much?
    Not within an application, because a true ICMP request requires root (a.k.a. Administrator) privilege. Really.
  • XIU (cs) in reply to dpm
    dpm:
    Patrick:
    uh... ping much?
    Not within an application, because a true ICMP request requires root (a.k.a. Administrator) privilege. Really.

    I can ping in Win7 without having to run as admin, and .NET also has a class to ping without needing admin access.

  • Jim (unregistered)

    ALTER TABLE [Comment] ADD frist bit, first bit, fist bit

    UPDATE [Comment] SET frist = 1...tbc

  • LAN Mind (unregistered)

    TRWTF is everyone who commented to say they don't see a WTF in this code.

    Captcha - transverbero. WTF?

  • Anonymous (unregistered) in reply to dpm
    dpm:
    Patrick: uh... ping much?

    Not within an application, because a true ICMP request requires root (a.k.a. Administrator) privilege. Really.

    which is why you have /sbin/ping suid root. oh wait, its basic, so its probably not an unix box... oh wait, that also explains the login slowness... where's the WTF, is the general dumbness of not using a proper OS?

  • bob171123 (cs) in reply to XIU
    XIU:
    dpm:
    Patrick:
    uh... ping much?
    Not within an application, because a true ICMP request requires root (a.k.a. Administrator) privilege. Really.

    I can ping in Win7 without having to run as admin, and .NET also has a class to ping without needing admin access.

    Win7 FTW!!!

  • Rootbeer (unregistered)

    Why would a mainframe -- a type of computer designed with reliability and availability as driving factors, and the price tag to prove it -- ever, EVER not be online?

  • dpm (cs) in reply to XIU
    XIU:
    dpm:
    a true ICMP request requires root (a.k.a. Administrator) privilege. Really.
    I can ping in Win7 without having to run as admin
    That only works because the PING.EXE file has the "setuid" bit set.
    and .NET also has a class to ping without needing admin access.
    I doubt that very much. Details, please?
  • pitchingchris (cs) in reply to Rootbeer
    Rootbeer:
    Why would a mainframe -- a type of computer designed with reliability and availability as driving factors, and the price tag to prove it -- ever, EVER not be online?

    Somebody unplugs a router/switch ? Power surge fries NIC? Come on, there are a million things that could make a mainframe unavailable to a particular app. Are you serious?

  • Resa (unregistered)

    I don't know if it's a wtf, but it's pretty dumb.

  • Win7 FTW!!! (unregistered) in reply to bob171123
    bob171123:
    Win7 FTW!!!

    You do realise that FTW is WTF backwards...

  • dtech (cs) in reply to dpm
    dpm:
    and .NET also has a class to ping without needing admin access.
    I doubt that very much. Details, please?

    System.Net.NetworkInformation.Ping... Found by googling ".NET ping", 3rd hit...

  • dkf (cs) in reply to dpm
    dpm:
    XIU:
    and .NET also has a class to ping without needing admin access.
    I doubt that very much. Details, please?
    It could be running a subprocess to do it behind the scenes (or asking a suitably-authorized service, which might actually be slightly more elegant). The problem with ICMP is that code that does it works with raw sockets, and there's traffic at that level that normal user code should not interfere with (e.g., ARP). If it was only ICMP ECHO, nobody would be very bothered.

    Of course, for a real heartbeat you need more than ping. It's better to use a service that's hosted inside the same connection infrastructure (software server, physical server, etc.) as the real service that you're keeping an eye on. Why? Because it's quite possible to have a machine that responds to ping without a working userland, or a working userland but no software service container, or a service container but no service instance, or… I've seen all of these happen for real. The closer you put the heartbeat to the thing that you're really monitoring, the better. (Only idiots and network admins rely on ping for monitoring, and netadmins should know what it is actually doing.)

  • @Deprecated (unregistered) in reply to Rootbeer
    Rootbeer:
    Why would a mainframe -- a type of computer designed with reliability and availability as driving factors, and the price tag to prove it -- ever, EVER not be online?

    Uhhh, 'cuz the cleaners need that electrical socket to polish the floors on Fridays at 1745?

  • erica (unregistered)

    The issue is not whether the mainframe is on. It probably is 24x7 and extra on Daylight Savings day shift.

    The issue is whether particular applications on the mainframe are running and accepting inputs. (They may be running, but in maintenance mode, so users have to wait for them to re-open).

    Whether a test of changing a table is the best way to decide that, is a interesting question. My best guess would be no, but then I do not have access to the change log that shows the previous attempts to solve the issue.

  • oldami (unregistered) in reply to dtech

    Nothing mentioned there about access restrictions. ???

    I have used every version of windows since 3.0 as well as most flavors of Unix/Linux. I have NEVER seen a restriction on using ping. Ever. What have you been smoking?

    Sure, if you tried to do it thru raw sockets, then you would have a problem. That's why MS supplies the icmp.dll library. I've used it many times. No admin access required.

  • Mats (unregistered) in reply to oldami

    I am fresh from college and our network ignores ICMP pakets, all of them!

  • M.C. (unregistered)

    The Real WTFs are 'application used Alex R.'s company isn't exactly bad' and 'deveoper'.

  • David Hamilton (unregistered)

    I would be fascinated to see what the application does if the mainframe is not online. I bet it just brings up a message stating "System Unavailable"!

  • Carl (unregistered) in reply to bob171123
    bob171123:
    XIU:
    I can ping in Win7 without having to run as admin, and .NET also has a class to ping without needing admin access.
    Win7 FTW!!!
    This has to be a troll, because non-admin ping has been available since at least 15 years ago and I would guess a lot longer than that.

    On the other hand, there are so many handy and timesaving features more than a quarter century old now that GUIs still haven't figured out how to implement* that I guess all you can celebrate are the pathetic gains of the latest minor tweak.

    • For just one example: typeahead. Why should you ever have to wait on your computer, when it has enough memory to buffer more key presses than you could make in an entire day?
  • Plz Send Me The Code (unregistered)

    So why was there a pause at login again? Because of a query against the database?

  • Greg (unregistered) in reply to XIU
    XIU:
    dpm:
    Patrick:
    uh... ping much?
    Not within an application, because a true ICMP request requires root (a.k.a. Administrator) privilege. Really.

    I can ping in Win7 without having to run as admin, and .NET also has a class to ping without needing admin access.

    Finally found the WTF, you're using Microsoft as your reference for how a standard should work?

  • dpm (cs) in reply to Carl
    Carl:
    non-admin ping has been available since at least 15 years ago
    I said, "a true ICMP request", which uses raw sockets, for which you do indeed need root.
  • Neville Flynn (unregistered) in reply to M.C.
    M.C.:
    The Real WTFs are 'application used Alex R.'s company isn't exactly bad' and 'deveoper'.

    It's like a drunken Yoda this article wrote.

    Captcha: validus... Darth Validus.

  • luis.espinal (cs) in reply to dpm
    dpm:
    Carl:
    non-admin ping has been available since at least 15 years ago
    I said, "a true ICMP request", which uses raw sockets, for which you do indeed need root.

    In that case, your comment is not applicable since, from the logical view of an app, a ping is a ping. For the app, whether it is a true ICMP request or a non-admin ping is irrelevant. Non sequitur.

    Focusing on the need (justified or not) to exec something that acts like a ping, I've never seen such a restriction (unless a sysadmin explicitly chmod 744 on ping.) Been working with NT/XP, Solaris, HP, AIX, several specimens the Linux bestiary, for almost 15 years, and I've never seen a intrinsic restriction of an app not running as root spawning/forking a ping.

    In general, nothing prevents an app on windows from spawning a shell command running ping. And in *nix platforms, applications run under specific users that might belong to groups. I can give any of these groups access to ping if I need to.

    On another note, even testing if a mainframe (or whatever) is up via ping is usually a brainf1rt.

    Instead of testing for physical server availability, you check for service availability. If it runs on somehost, and if it runs on TCP on port 1234, you simply attempt to establish a telnet connection to that port (or a TCP connection pro grammatically from within the application). If the service is up, you'll get the telnet connection (or tcp connection). You can't do anything with it since the service is not really telnet, but that's beyond the point. You got the connection - proof that it is up.

  • Jesse (unregistered)

    First... Instead of trying to add a column and see if it would fail, you can check if it exists and add it if not.

    Second... If you set the default to 1, you can skip the initial setting of the column value.

    Third... Why th ehell has the user connecting to teh database the rights to change the schema?

    Last... Exit try, empty try catch boxes, no try catch on the last statement... ARGH!

    (hehe CAPTCHA: damn um )

  • dpm (cs) in reply to luis.espinal
    luis.espinal:
    Focusing on the need (justified or not) to exec something that acts like a ping, I've never seen such a restriction (unless a sysadmin explicitly chmod 744 on ping.)
    I'm not sure what you're saying here. Every unix system I've seen has /bin/ping installed "setuid root", and Windows boxes have the equivalent. So any used can run the program, and temporarily has root access so that the attempt to use raw sockets will succeed.
  • snoofle (cs) in reply to Rootbeer
    Rootbeer:
    Why would a mainframe -- a type of computer designed with reliability and availability as driving factors, and the price tag to prove it -- ever, EVER not be online?
    Because the cleaning crew came through and needed the outlet? Edit: nuts; someone beat me to it!
  • Some Unix Guru (unregistered) in reply to Anonymous
    Anonymous:
    dpm:
    Patrick: uh... ping much?

    Not within an application, because a true ICMP request requires root (a.k.a. Administrator) privilege. Really.

    which is why you have /sbin/ping suid root. oh wait, its basic, so its probably not an unix box... oh wait, that also explains the login slowness... where's the WTF, is the general dumbness of not using a proper OS?

    QFT.

    "Those who don't understand UNIX are condemned to reinvent it, poorly." – Henry Spencer

    Q.E.D. Microsoft Windows

  • dtfhg (unregistered) in reply to Mats

    I can guarantee you they won't ignore the RCMP though!

  • akatherder (cs) in reply to Plz Send Me The Code
    Plz Send Me The Code:
    So why was there a pause at login again? Because of a query against the database?

    I'll summarize. There are two systems. A database and a mainframe. When the users try logging into the mainframe, a script checks the database to see if the mainframe is currently available. It is this "check" shown in the code, that creates the pause.

    The idea of checking a database, to see if a mainframe is available, is questionable. There were a couple other reasons mentioned, but if your database server goes down, you probably just blocked the front door to your mainframe also (based on the level of forethought by the developer).

    The way that they are checking the database is certainly a WTF. You have some serious issues if you need to check that a column exists in a table before you query the column. And the way they check is just silly (by adding the damn column and erroring if it already exists).

  • GrumpyOldGeek (unregistered) in reply to Mats

    As soon as you get a little experience, it will start responding to them.

  • Yanman (unregistered)

    Pong>Ping

  • Bim Job (unregistered) in reply to Some Unix Guru
    Some Unix Guru:
    Anonymous:
    dpm:
    Patrick: uh... ping much?

    Not within an application, because a true ICMP request requires root (a.k.a. Administrator) privilege. Really.

    which is why you have /sbin/ping suid root. oh wait, its basic, so its probably not an unix box... oh wait, that also explains the login slowness... where's the WTF, is the general dumbness of not using a proper OS?

    QFT.

    "Those who don't understand UNIX are condemned to reinvent it, poorly." – Henry Spencer

    Q.E.D. Microsoft Windows

    Apparently, you've never heard of Multics.

    There are three (I'm open to alternatives) descendents of Multics.

    One of them was VMS. We'll deal with that later.

    The second was Stratus VOS. I'd argue that VOS was the ultimate Multics ... but it was tied to the hardware, and couldn't compete.

    The third, and most pitiful, was Unix. Oh, joy! Suddenly, an operating system that makes PDP-7/9/11s look useful!

    Sadly, or not -- and it's a shame to have to give up on 1970s OSes -- nobody in their right mind would listen to Henry. Linux, for example, is Unix reinvented poorly. Tubularly poorly.

    VOS was a damn good shot. VMS is now (buggered up as) Windows, and it just about makes the grade. OSX is a decent facade in front of a decent BSD implementation.

    Other than that: Spencer is talking out of his arse.

    Time for a CAP micro-kernel, I think. And bollocks to Posix compliance.illum

  • Harold (unregistered) in reply to leppie

    I think the people that thought the database was on the mainframe are wrong. The database has the status of the mainfrme in it. The first time it tries to check the status, the table is altered,and the table is updated to say if the databse is up or not. It appears that the code:

    If _Settings.GetSetting("General", "MainframeOn", False) Then t = "1"

    indicates the state of the mainframe, as this is used to update the table.

    After the first time, the table will just be queried. But the table is not correct is it? why not just execute that line of code related to GetSetting?

    That's The real WTF isn't it?

  • Kang (unregistered) in reply to leppie

    Who runs code...prior to any login...with ALTER DB permissions?

  • Jeremy (unregistered) in reply to Kang
    Kang:
    Who runs code...prior to any login...with ALTER DB permissions?
    I do. I'm an SQL injection hacker...
  • Satanicpuppy (cs) in reply to Patrick
    Patrick:
    uh... ping much?

    Ping doesn't cut it if what you care about encompasses more than just the network subsystem. You can lose your database without losing the server.

Leave a comment on “Is the Mainframe On?”

Log In or post as a guest

Replying to comment #:

« Return to Article