These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Information Portal

 
  • Topic is locked indefinitely.
Previous page123
 

Dev blog: Sleeping beauty - How one of the oldest bugs in EVE ...

First post
Author
CCP Snorlax
C C P
C C P Alliance
#41 - 2017-02-16 10:18:46 UTC
Taryn Earendil wrote:
I am a C++ newb. When I'm doing systems stuff, I use Rust. Mostly, because I'm into being a hipster developer...... but my question is with this RemoveSleeper function:

void Synchro::RemoveSleeper( Heap &sleepers, Sleeper &sl )
{
    SleeperIt it;
    for( it = sleepers.begin(); it != sleepers.end(); ++it )
    {
        if( it->channel == sl.channel )
        {
            break;
        }
    }

    if( it != sleepers.end() )
    {
        //Ok found us.  Let's delete us.
        sleepers.Remove( it );
        Py_DECREF( sl.channel );
    }
}


Would this be a more succint way to do it?

void Synchro::RemoveSleeper( Heap &sleepers, Sleeper &sl )
{
    SleeperIt it;
    for( it = sleepers.begin(); it != sleepers.end(); ++it )
    {
        if( it->channel == sl.channel )
        {
            //Ok found us.  Let's delete us.
            sleepers.Remove( it );
            Py_DECREF( sl.channel );
            break;
        }
    }
}

Yeah, sure, but in this case I omitted some code that was irrelevant to the example.

CCP Snorlax - Software Architect - Team RnB - @CCP_Snorlax - http://ccpsnorlax.blogspot.is/

CCP Snorlax
C C P
C C P Alliance
#42 - 2017-02-16 10:20:49 UTC
Thoirdhealbhach wrote:
Elegbara wrote:
Fascinating read.

Also I've actually tried to read the code and there's definitely something wrong in the Synchro::Tick snippet. The for loop seems corrupted.


Yep, seems like the last third of the for command got eaten up during copy&paste.

Anyhow, my sympathies, I've been chasing some bad reference counting myself for the better part of last month.

It seems that a portion of the code looked similar to HTML so the content management system swallowed it - it's been fixed now.

CCP Snorlax - Software Architect - Team RnB - @CCP_Snorlax - http://ccpsnorlax.blogspot.is/

CCP Snorlax
C C P
C C P Alliance
#43 - 2017-02-16 10:23:10 UTC
Branquinha wrote:
(slow clap)
(/bows to magnificence of analysis)

You must have felt pretty good after that one! Cool

Just out of curiosity, aprox how many hours until you found it? And how many "I'm not finding anything breaks!" ?


I don't know how long CCP karkur had spent on this, but after she'd basically proven in had to be in the Sleep command, I spent 3 solid working days on this, much of that in a staring contest with the code...

CCP Snorlax - Software Architect - Team RnB - @CCP_Snorlax - http://ccpsnorlax.blogspot.is/

CCP Snorlax
C C P
C C P Alliance
#44 - 2017-02-16 10:23:54 UTC
Illiana ShadowGlade wrote:
This was an awesome read. I did IT in high school and got paid to run the the servers there over the summers after I graduated and trying to find code was always a pain.

Have you guys tried using the rubber ducky method?
Grab a rubber ducky.
Sit it on your desk/keyboard what have you...
Explain to the duck the code.
Two or three times if you have to.
Eventually it'll hit you like a truck and you will probably throw the duck across the room because the 'stupid complex problem' has a simple solution, or it's something you never second guessed until that duck just gives you it's dead placid stare.

I used a colleague instead. I refrained from throwing him across the room.

CCP Snorlax - Software Architect - Team RnB - @CCP_Snorlax - http://ccpsnorlax.blogspot.is/

Katrina Bekers
Pandemic Horde Inc.
Pandemic Horde
#45 - 2017-02-16 11:09:34 UTC
CCP Snorlax wrote:
I used a colleague instead. I refrained from throwing him across the room.

Poor Guard!!!

Anyway, CCP Snorlax proves once and again to be one of the best devs of our favorite icelandic software house.

Can't wait for his roundtables at Fanfest.

<< THE RABBLE BRIGADE >>

Tonto Auri
Vhero' Multipurpose Corp
#46 - 2017-02-16 14:55:26 UTC
I'm wondering though. Do C++ supports the concept of destructors?
In a language that does, I would place all cleanup code in a destructor and call it a day. Especially service objects cleanup.

Two most common elements in the universe are hydrogen and stupidity. -- Harlan Ellison

CCP Snorlax
C C P
C C P Alliance
#47 - 2017-02-16 15:02:41 UTC
Tonto Auri wrote:
I'm wondering though. Do C++ supports the concept of destructors?
In a language that does, I would place all cleanup code in a destructor and call it a day. Especially service objects cleanup.

Sure, but the Python C API is just that - a C API, not a C++ API.

CCP Snorlax - Software Architect - Team RnB - @CCP_Snorlax - http://ccpsnorlax.blogspot.is/

Sentient Blade
Crisis Atmosphere
Coalition of the Unfortunate
#48 - 2017-02-16 16:05:02 UTC
CCP Snorlax wrote:
Tonto Auri wrote:
I'm wondering though. Do C++ supports the concept of destructors?
In a language that does, I would place all cleanup code in a destructor and call it a day. Especially service objects cleanup.

Sure, but the Python C API is just that - a C API, not a C++ API.


https://s-media-cache-ak0.pinimg.com/564x/ff/88/21/ff8821dda34f16b946434236505df4ca.jpg

Don't be silly, wrap your... C resource types inside reference countered pointers with suitable encapsulation.
dirtycasual
Garoun Investment Bank
Gallente Federation
#49 - 2017-02-16 16:23:08 UTC
Katherine Hakoke wrote:
This is quite possibly the only MMO I know of that is willing to get technical and actually talk about what is going on.


<3 CCP
FearlessLittleToaster
The Scope
Gallente Federation
#50 - 2017-02-16 17:10:07 UTC
With this bug fixed can you work on the one that makes my ships explode when I undock drunk? I've reproduced it nearly 100% of the time when the conditions exist...
Captain Campion
Campion Corp.
#51 - 2017-02-16 17:57:58 UTC
It's running a ton better now, great work.
Lors Dornick
Kallisti Industries
#52 - 2017-02-16 18:34:46 UTC
FearlessLittleToaster wrote:
With this bug fixed can you work on the one that makes my ships explode when I undock drunk? I've reproduced it nearly 100% of the time when the conditions exist...

For them to be able to reproduce this accurately you'll have to provide a serious amount (they are Icelandic after all) of alcohol with your bug report.

CCP Greyscale: As to starbases, we agree it's pretty terrible, but we don't want to delay the entire release just for this one factor.

CCP Snorlax
C C P
C C P Alliance
#53 - 2017-02-16 18:51:51 UTC
FearlessLittleToaster wrote:
With this bug fixed can you work on the one that makes my ships explode when I undock drunk? I've reproduced it nearly 100% of the time when the conditions exist...

I always get a headache when trying to reproduce the bug.

CCP Snorlax - Software Architect - Team RnB - @CCP_Snorlax - http://ccpsnorlax.blogspot.is/

Cristl
#54 - 2017-02-16 20:02:05 UTC
CCP Snorlax wrote:
FearlessLittleToaster wrote:
With this bug fixed can you work on the one that makes my ships explode when I undock drunk? I've reproduced it nearly 100% of the time when the conditions exist...

I always get a headache when trying to reproduce the bug.

Heh, nice!
Gaius Ambramotte
Fistful of Finns
#55 - 2017-02-17 07:23:28 UTC
In your example code was a syntax error as far I understand C++:

if (sleepers.size()) {
Be::Time nnow = BeOS->GetActualTime();
for(unsigned int i = 0; iPyError();
} <---- "}" should be " ) {"
Py_DECREF(s.channel);
}
}

CCP Snorlax
C C P
C C P Alliance
#56 - 2017-02-17 09:22:12 UTC
Gaius Ambramotte wrote:
In your example code was a syntax error as far I understand C++:

if (sleepers.size()) {
Be::Time nnow = BeOS->GetActualTime();
for(unsigned int i = 0; iPyError();
} <---- "}" should be " ) {"
Py_DECREF(s.channel);
}
}


The CMS messed with the formatting of the code segments, resulting in some of it disappearing. It's been fixed now.

CCP Snorlax - Software Architect - Team RnB - @CCP_Snorlax - http://ccpsnorlax.blogspot.is/

RaVenC
Deep Exploration Projects and Programs
Snuffed Out
#57 - 2017-02-17 16:42:57 UTC
And still endless loops when "begin" is greater than "end" by [insert random issue here] Ugh
MeagerMiner
#58 - 2017-02-17 22:03:43 UTC
Shocked
I never get tired of hearing and seeing how dedicated our Devs work to keep us flying space ships around!

Appreciate the talent that CCP has on the team as well.

CCP Snorlax and CCP Karkur thanks for your continued efforts!

Yunaride
The Cruciform
Keep Calm and Parley
#59 - 2017-02-18 23:47:47 UTC
thank you for sharing.
this attitude towards your payer base is really unique and simply awesome.
Mara Pahrdi
The Order of Anoyia
#60 - 2017-03-04 10:00:52 UTC
+x to CCP Snorlax and thanks for sharing.

Great read.

Remove standings and insurance.

Previous page123