Tuesday, April 18, 2017

CodeSOD: The Wrong Sacrifice

pentacle




Folks, you need to choose a different sacrificial animal for your multithreading issues. Thanks to this comment Edward found in a stubborn bit of Java code, we now know the programming gods won't take our goats.

public static boolean doSomeOSStuff() {

        // Forgive me father for I have sinned - with the bag of crap written in the lines below.
        // When running multiple threads (~500) concurrently, the damn OS commands fail at a 1% rate for no apparent reason.
        // There is no error message, or any indication of failure, they just don't happen and come bite you in the ass.
        // After much frustration, I decided to try 3 things:
        // 1. sacrifice a goat. - did not go as planned.
        // 2. semaphoring this shit. did not change anything...
        // 3. after each failed command, I will try and verify if it succeeded  or not. If not I'll try it 4 more times.
        // I am now going home to take a hot shower, and cry laying on the shower floor. and /or sacrifice a few more goats.
        //
        //                                          ...
        //                       s,                .                    .s
        //                        ss,              . ..               .ss
        //                        'SsSs,           ..  .           .sSsS'
        //                         sSs'sSs,        .   .        .sSs'sSs
        //                          sSs  'sSs,      ...      .sSs'  sSs
        //                           sS,    'sSs,         .sSs'    .Ss
        //                           'Ss       'sSs,   .sSs'       sS'
        //                  ...       sSs         ' .sSs'         sSs       ...
        //                 .           sSs       .sSs' ..,       sSs       .
        //                 . ..         sS,   .sSs'  .  'sSs,   .Ss        . ..
        //                 ..  .        'Ss .Ss'     .     'sSs. ''        ..  .
        //                 .   .         sSs '       .        'sSs,        .   .
        //                  ...      .sS.'sSs        .        .. 'sSs,      ...
        //                        .sSs'    sS,     .....     .Ss    'sSs,
        //                     .sSs'       'Ss       .       sS'       'sSs,
        //                  .sSs'           sSs      .      sSs           'sSs,
        //               .sSs'____________________________ sSs ______________'sSs,
        //            .sSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS'.Ss SSSSSSSSSSSSSSSSSSSSSs,
        //                                    ...         sS'
        //                                     sSs       sSs
        //                                      sSs     sSs
        //                                       sS,   .Ss
        //                                       'Ss   sS'
        //                                        sSs sSs
        //                                         sSsSs
        //                                          sSs
        //                                           s
        
        // snipped OS manipulation code with several cases of aforementioned ritual
}

[Advertisement] High availability, Load-balanced or Basic – design your own Universal Package Manager, allow the enterprise to scale as you grow. Download and see for yourself!


To read the full article, please visit The Daily WTF

No comments:

Post a Comment