ENIGMA Forums

Outsourcing saves money => Issues Help Desk => Topic started by: cheeseboy on August 08, 2013, 01:14:23 PM

Title: FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!
Post by: cheeseboy on August 08, 2013, 01:14:23 PM
My games crashing in same spot every time and the error message couldn't be any less helpful. Please fix.

Error:
FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!
FFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUCK!

Program received signal SIGSEGV, Segmentation fault.
0x000000000040b0e4 in enigma::ENIGMA_events () at Preprocessor_Environment_Editable/IDE_EDIT_events.h:80
80         ((enigma::event_parent*)(instance_event_iterator->inst))->myevent_beginstep();

Code: [Select]
/********************************************************************************\
**                                                                              **
**  Copyright (C) 2008 Josh Ventura                                             **
**                                                                              **
**  This file is a part of the ENIGMA Development Environment.                  **
**                                                                              **
**                                                                              **
**  ENIGMA is free software: you can redistribute it and/or modify it under the **
**  terms of the GNU General Public License as published by the Free Software   **
**  Foundation, version 3 of the license or any later version.                  **
**                                                                              **
**  This application and its source code is distributed AS-IS, WITHOUT ANY      **
**  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS   **
**  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more       **
**  details.                                                                    **
**                                                                              **
**  You should have recieved a copy of the GNU General Public License along     **
**  with this code. If not, see <http://www.gnu.org/licenses/>                  **
**                                                                              **
**  ENIGMA is an environment designed to create games and other programs with a **
**  high-level, fully compilable language. Developers of ENIGMA or anything     **
**  associated with ENIGMA are in no way responsible for its users or           **
**  applications created by its users, or damages caused by the environment     **
**  or programs made in the environment.                                        **
**                                                                              **
\********************************************************************************/

//This file was generated by the ENIGMA Development Environment.
//Editing it is a sign of a certain medical condition. We're not sure which one.

namespace enigma
{
  event_iter *event_alarm; // Defined in 20 objects
  event_iter *event_animationend; // Defined in 5 objects
  event_iter *event_beforecollisionautomaticcollisionhandling; // Defined in 0 objects
  event_iter *event_beginstep; // Defined in 0 objects
  event_iter *event_collision; // Defined in 8 objects
  event_iter *event_create; // Defined in 17 objects
  event_iter *event_draw; // Defined in 4 objects
  event_iter *event_keyboard; // Defined in 2 objects
  event_iter *event_localsweep; // Defined in 0 objects
  event_iter *event_particlesystemsupdate; // Defined in 0 objects
  event_iter *event_step; // Defined in 14 objects
  int event_system_initialize()
  {
    events = new event_iter[11]; // Allocated here; not really meant to change.
    objects = new objectid_base[21]; // Allocated here; not really meant to change.
    event_alarm = events + 0;  event_alarm->name = "Alarm ...";
    event_animationend = events + 1;  event_animationend->name = "Animation End";
    event_beforecollisionautomaticcollisionhandling = events + 2;  event_beforecollisionautomaticcollisionhandling->name = "Before collision automatic collision handling";
    event_beginstep = events + 3;  event_beginstep->name = "Begin Step";
    event_collision = events + 4;  event_collision->name = "obj_19";
    event_create = events + 5;  event_create->name = "Create";
    event_draw = events + 6;  event_draw->name = "Draw";
    event_keyboard = events + 7;  event_keyboard->name = "Keyboard <key8>";
    event_localsweep = events + 8;  event_localsweep->name = "Locals sweep";
    event_particlesystemsupdate = events + 9;  event_particlesystemsupdate->name = "Particle Systems Update";
    event_step = events + 10;  event_step->name = "Step";
    return 0;
  }
  int game_settings_initialize()
  {
    window_set_fullscreen(0);
    texture_set_interpolation(0);
    window_set_cursor(cr_none);
    window_set_region_scale(-0.01, 0);
    window_set_sizeable(0);
    window_set_stayontop(0);
    window_set_showborder(1);
    window_set_showicons(1);
    return 0;
  }
  variant ev_perf(int type, int numb)
  {
    return ((enigma::event_parent*)(instance_event_iterator->inst))->myevents_perf(type, numb);
  }
  int ENIGMA_events()
  {
    for (instance_event_iterator = event_beginstep->next; instance_event_iterator != NULL; instance_event_iterator = instance_event_iterator->next) {
      ((enigma::event_parent*)(instance_event_iterator->inst))->myevent_beginstep();
      if (enigma::room_switching_id != -1) goto after_events;
    }
   
    enigma::update_globals();
   
    for (instance_event_iterator = event_alarm->next; instance_event_iterator != NULL; instance_event_iterator = instance_event_iterator->next) {
      ((enigma::event_parent*)(instance_event_iterator->inst))->myevent_alarm();
      if (enigma::room_switching_id != -1) goto after_events;
    }
   
    enigma::update_globals();
   
    for (instance_event_iterator = event_keyboard->next; instance_event_iterator != NULL; instance_event_iterator = instance_event_iterator->next) {
      ((enigma::event_parent*)(instance_event_iterator->inst))->myevent_keyboard();
      if (enigma::room_switching_id != -1) goto after_events;
    }
   
    enigma::update_globals();
   
    for (instance_event_iterator = event_step->next; instance_event_iterator != NULL; instance_event_iterator = instance_event_iterator->next) {
      ((enigma::event_parent*)(instance_event_iterator->inst))->myevent_step();
      if (enigma::room_switching_id != -1) goto after_events;
    }
   
    enigma::update_globals();
   
    for (instance_event_iterator = event_localsweep->next; instance_event_iterator != NULL; instance_event_iterator = instance_event_iterator->next) {
      ((enigma::event_parent*)(instance_event_iterator->inst))->myevent_localsweep();
      if (enigma::room_switching_id != -1) goto after_events;
    }
   
    enigma::update_globals();
   
    enigma::perform_callbacks_before_collision_event();   
   
    enigma::update_globals();
   
    for (instance_event_iterator = event_collision->next; instance_event_iterator != NULL; instance_event_iterator = instance_event_iterator->next) {
      ((enigma::event_parent*)(instance_event_iterator->inst))->myevent_collision();
      if (enigma::room_switching_id != -1) goto after_events;
    }
   
    enigma::update_globals();
   
    enigma::perform_callbacks_particle_updating();   
   
    enigma::update_globals();
   
    if (automatic_redraw) screen_redraw();   
   
    enigma::update_globals();
   
    for (instance_event_iterator = event_animationend->next; instance_event_iterator != NULL; instance_event_iterator = instance_event_iterator->next) {
      ((enigma::event_parent*)(instance_event_iterator->inst))->myevent_animationend();
      if (enigma::room_switching_id != -1) goto after_events;
    }
   
    enigma::update_globals();
   
    after_events:
    if (keyboard_check_pressed(vk_escape)) game_end();
    if (keyboard_check_pressed(vk_f4)) window_set_fullscreen(!window_get_fullscreen());
    if (keyboard_check_pressed(vk_f1)) show_info();
    if (keyboard_check_pressed(vk_f9)) {}
    //if (keyboard_check_pressed(vk_f5)) game_save('_save542964527.sav');
    //if (keyboard_check_pressed(vk_f6)) game_load('_save542964527.sav');
    enigma::dispose_destroyed_instances();
    enigma::rooms_switch();
    enigma::sleep_for_framerate(room_speed);
   
    return 0;
  } // event function
} // namespace enigma
Title: Re: FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!
Post by: Goombert on August 08, 2013, 01:26:27 PM
Alright seriously this is sickening this crap needs removed from the compiler output, this is a game engine FOR CHILDREN, do you have no morals or common sense Josh? This does nothing more than show you have a very poor ability to articulate yourself, and it affects the rest of us developers as well. The information it outputs is not even relevant, you can't properly debug stuff like this, it is just making a fucking laughing stock of us. DatZach is right, this is why we are the butt of every fucking joke.
Title: Re: FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!
Post by: TheExDeus on August 08, 2013, 04:33:06 PM
I don't think it returned that before SIGSEGV, so cheer up Rob.

That error can only happen in instance_destroy(), but there should be 3 lines, not 2. And it shouldn't ever happen unless memory got corrupt or something.
Title: Re: FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!
Post by: Josh @ Dreamland on August 08, 2013, 04:59:57 PM
Shut up, Robert. Keep shitposting like that and I'll put you in charge of the event system. Or maybe you can have Zach write it for you. If you expect my assistance, you can accept it for what it is. Otherwise, fuck you. I'll take my leave.

Anyway. That error, known colloquially as the 14-fuck exception, happens in the event of miserable iterator failure in the engine. Particularly, in the instance system. In early stages of development, this happened when destroying instances to which iterators were held. I then implemented a central tracker for iterators, and a very simple garbage collection system for destroyed instances, to prevent any such mishaps. It should never happen, unless someone changed something.

To be honest, my guess is that in cheeseboy's great belligerence, he reverted to a four-year-old revision of ENIGMA. But assuming he'd not be stupid enough to do that and then bitch when it didn't work, I'm going to need more info. The game is doing *something* to piss off the iterator system. The info you provided isn't enough, cheeseboy; I need either your game or the IDE_EDIT_object*.h files.

Code: (C++) [Select]
    if (enigma::cleanups.find(a) == enigma::cleanups.end())
        enigma::instance_event_iterator->inst->unlink();
    if (enigma::cleanups.find(a) == enigma::cleanups.end())
    printf("FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!\nFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUCK!\nFUCK! %p ISN'T ON THE GOD DAMNED MOTHER FUCKING STACK!", (void*)a);

As you can see, that only happens if for some fucking reason, the object was told to unlink itself, but then didn't register itself properly for garbage collection. Did one of you attempt to implement something new and exciting with the instance system?

And yes, as Harri pointed out right before I posted, general memory corruption could also be at play. I might need you to run Valgrind on the game, assuming it plays well with the engine.
Title: Re: FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!
Post by: forthevin on August 08, 2013, 06:36:27 PM
I cannot find any recent changes that should affect the instance system. cheeseboy, is the error reproducible, and if so, could you provide the source and instructions for how to reproduce it?
Title: Re: FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!
Post by: Josh @ Dreamland on August 08, 2013, 06:58:39 PM
I'm dealing with this over IRC, forthevin. From what I gather, it is not reproducible except in his own game. It looks ugly and deep-seeded, a fact exacerbated by ENIGMA's woefully inadequate organization in the instance system, which is entirely my fault. I may have to start on my instance system refactoring plans early.
Title: Re: FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!
Post by: Goombert on August 08, 2013, 07:48:51 PM
Quote
I don't think it returned that before SIGSEGV, so cheer up Rob.
I am sorry, it just really upsets and annoys me, because I know we are all working exceptionally hard to do a good job.
Quote
Shut up, Robert. Keep shitposting like that and I'll put you in charge of the event system
:/ He's is part of why I am upset, and you're not making it any better.
Quote
I'm going to need more info. The game is doing *something* to piss off the iterator system. The info you provided isn't enough, cheeseboy
Perhaps if you would make it print real debug errors instead of literally random shit, maybe you wouldn't have that problem.
Title: Re: FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!
Post by: Josh @ Dreamland on August 08, 2013, 09:28:19 PM
Quote
Perhaps if you would make it print real debug errors instead of literally random shit, maybe you wouldn't have that problem.
If you knew the FIRST fucking thing about this system or about anything I just said, you'd realize that there is NO useful info that can be collected. This problem should NOT happen, under any circumstance, and is indicative of memory corruption, which valgrind has pointed out.

For interested parties, this is the dump of errors from valgrind here (http://pastebin.com/SkpiAbdg).

You can disregard the leak reports; they're from the segfault.
Title: Re: FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!
Post by: Josh @ Dreamland on August 08, 2013, 09:55:28 PM
In other news, this bug was from a double free. The cause was two instances having the same ID, as assigned by the IDE. Both instances were assigned 100134; when the first was destroyed, it freed the rb_tree iterator for instance 100134. When the second instance was destroyed, it tried to do the same, resulting in the invalid read you see in that (incomplete) valgrind dump.

I'm going to file a bug against LGM, and tomorrow I'm going to add duplicate checking to debug mode for IDs. What a fucking bitch of an error.

I'll probably also fix the font_add new[]/delete mismatch.
Title: Re: FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK! FUCK!
Post by: polygone on August 09, 2013, 07:22:27 AM
Oh I was actually going to suggest something like that, never mind.