x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

ENGINE CRASHES sometimes with my actor class: "ACCESS VIOLATION"

Hello.

When the Engine crashes I get this error:

alt text

In my Projectile.cpp I have this:

alt text

What could the reason be? It says "Access violation", but why?

Also, keep in mind this crash happens RARELY and not everytime a Missile that I shoot explodes.

Product Version: UE 4.10
Tags:
1.jpg (170.0 kB)
2.jpg (76.2 kB)
more ▼

asked May 17 '16 at 04:47 PM in C++ Programming

avatar image

gedamial
127 39 37 51

avatar image Doug E ♦♦ STAFF May 17 '16 at 04:54 PM

Hey gedamial-

The access violation is likely caused because MovementComp is null when you are trying to access it. Can you explain what you were doing when the crash occurred? Were you working inside a blueprint, playing in the editor, etc. Any information you can provide about the circumstances when the crash occurred will be helpful in determining the cause.

avatar image gedamial May 17 '16 at 04:57 PM

Yes, I knew that was something related to the MovementComp pointer

The worst thing here is that the crash is not consistent

I'm firing a lot of Missiles and it's not crashing right now, but it has already crashed 2-3 times until now.

All I'm doing, by the way, is simply spawning the Missiles.

avatar image Doug E ♦♦ STAFF May 17 '16 at 05:48 PM

It appears the crash is happening in your DestroyProjectile() function so it may be tied to when the projectile is removed from the level. If you face a wall and fire (so you are shooting into the wall mesh) can you let me know if a crash occurs then? Also, if you could provide the log files the next time the crash occurs it will help determine the cause of the crash.

avatar image gedamial May 17 '16 at 06:04 PM

I'm firing the projectile everywhere. It crashes randomly after a random ammount of time. It's completely unpredictable!

Also, please notice in the screenshot the error message related to FTimer, FTimerManager and such... because I'm actually using timers.

I attached the crash log!

link text

avatar image Doug E ♦♦ STAFF May 17 '16 at 06:25 PM

The messages about FTimer are just showing which functions were called prior to when the crash occurred. Without knowing more about the circumstances when the crash occurs, the best solution I can think of would be to put line 196 inside an if(MovementComp != NULL) check. If you do continue to see this crash with this change to the code, please provide a copy of the project for me to test directly. If you can zip the project you can then attach it to a post. The post can be marked as private so that only moderators and yourself can see it.

avatar image gedamial May 17 '16 at 06:48 PM

This is what I tried alt text

The if statement checks whether the MovementComp is valid or not. If not, it prints an error.

I tried that out and it crashes the same; it doesn't even show me the error message!

It's like the MovementComp is actually a valid pointer... but for some reason it crashes.

Anyway, tell me how to make a post private so I will upload my project. It will take while, since my upload speed is very low.

11.jpg (108.0 kB)
avatar image Doug E ♦♦ STAFF May 17 '16 at 06:55 PM

When adding a comment, there is a drop down arrow just below the blue "comment" button. Here you can specify who is able to see the comment or attachments to that comment

avatar image gedamial May 17 '16 at 07:00 PM

I don't see any arrow below the "comment" button.

alt text

P.S: I'm uploading the project to Google Drive.

121.jpg (79.6 kB)
avatar image Doug E ♦♦ STAFF May 17 '16 at 07:10 PM

If you are uploading it to google drive, you can send me a PM on the forums with a download link to the project instead.

avatar image gedamial May 17 '16 at 08:07 PM

Ok, I sent you the link on the forums. I forgot to remove the password of the .rar, it's hi0

avatar image Doug E ♦♦ STAFF May 18 '16 at 06:06 PM

Hey gedamial-

I received the project you sent and attempted to test on my end. When I press the left mouse button to fire, it shoots out a line trace. Holding the button continues to shoot multiple line traces. After testing this multiple times for about 5 minutes per test I did not receive a crash. Can you explain what exactly you mean by "spawning the missiles"? If you're doing something other than just holding the left mouse button, can you indicate what else needs to be done?

avatar image gedamial May 18 '16 at 06:31 PM

I apologize for not having explained the issue steps before.

In order to fire the missiles, you need to Pickup the MissileLauncher which is a pickup in the level with a very basic 3d mesh of a cylinder.

Once you pick it up, press Q to Equip it.

Now you can shoot with it. I recommend to pickup the Missile Launcher many times, as you need a lots of ammunitions to shoot for the Engine to crash.

avatar image Doug E ♦♦ STAFF May 18 '16 at 07:51 PM

How exactly do I pick up the missile launcher? Walking over it doesn't seem to do anything.

avatar image gedamial May 18 '16 at 07:57 PM

It's weird, really weird.

Look: https://www.youtube.com/watch?v=JiXO7OCcRnE

I can't think of any reason why you're facing that. Updates?

avatar image Doug E ♦♦ STAFF May 19 '16 at 02:10 PM

I was able to pickup the rockets after a small edit to the OnPickup delegate however I did not experience a crash when firing the rockets. If you are still encountering the crash, can you try commenting out the MovementComp->StopMovementImmediately() line and let me know if the crash continues to occur?

avatar image gedamial May 19 '16 at 02:13 PM

The crash is difficult to achieve, I told you.

For the crash to occur, you need to fire a bunch of rockets, many many. It really depends.

The first time it crashed, it was the first shot. The second time it was after like 40 shots.

If you haven't tried enough, please retry. The crash will be about to come up.

ALSO you want to shoot at your feet

avatar image Doug E ♦♦ STAFF May 19 '16 at 02:41 PM

I had tested multiple times, firing dozens of shots per test with no crash. I tried again while aiming at the floor and again fired ~50 times without getting a crash. Please let me know if commenting out the StopMovementImmediately() line has any affect on your project.

avatar image gedamial May 19 '16 at 03:06 PM

I think 50 rockets are still not enough. Please, see: https://youtu.be/9A5Mcjxdm6c

By the way I commented that line as you suggested, but the crash still occurs!

Crash found on line 210... ?_?

alt text

1.jpg (357.3 kB)
avatar image gedamial May 19 '16 at 03:07 PM

I think there's a mismatch between client and server. Like, the rocket gets destroyed first on one of the two, and then it tries to destroy it again, but since it's already destroyed it crashes

avatar image Doug E ♦♦ STAFF May 20 '16 at 05:19 PM

After testing both server and client shooting rockets for about five minutes each I haven't seen this yet, but I'll keep trying to reproduce it periodically. I would also like to add that, in the project you sent me, the projectiles do not move after spawn. They remain in place for about three seconds before being destroyed. If the projectiles are destroyed both after a set amount of time as well as after impacting with an object/surface, it is possible that in rare cases the destroy function is being called twice.

avatar image gedamial May 20 '16 at 06:03 PM

I would also like to add that, in the project you sent me, the projectiles do not move after spawn

Try opening the Proj_Rocket blueprint in the path Blueprint->Projectiles and changing the "Speed" to about 800. Also make sure the "Is Explosive" boolean is checked. Also, in the Effects panel, make sure the Explosion Template is set to Missile_ExplosionFX

If the projectiles are destroyed both after a set amount of time as well as after impacting with an object/surface, it is possible that in rare cases the destroy function is being called twice.

If you see in the DestroyProjectile() function inside Projectile.cpp I make only the Server destroy the projectile. This destruction is then replicated to all Clients. It shouldn't crash!!

I haven't seen this yet, but I'll keep trying to reproduce it periodically

Thanks, it's really important!

For now, just test this on the Client because, in 90% of the cases, the Server always gets things right.

Let me know!

avatar image gedamial May 23 '16 at 07:17 PM

Any news?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey gedamial-

I was finally able to get the crash to occur after deleting the project and unzipping it again. By removing the 'else' from DestroyProjectile() but leaving in the debug message, I found that the DestoryProjectile() function is being called twice when a rocket is destroyed. The crash is occurring on the second call to the function which seems to indicate that when the call is made the second time the object has already been destroyed, and looking for the movement component or comparing the explosion variables is being done on an object that no longer exists. Ensuring that the function is only called once per rocket should prevent the crash from occurring.

Cheers

Doug Wilson

more ▼

answered May 23 '16 at 08:59 PM

avatar image gedamial May 23 '16 at 09:12 PM

I would say it's due to this Timer in the BeginPlay() function

 void AProjectile::BeginPlay()
 {
     /* TRIGGER TIMER FOR THE PROJECTILE LIFETIME EXPLOSION */
     FTimerDelegate ExplosionDelegate = FTimerDelegate::CreateLambda([=]()
     {            
         
         this->DestroyProjectile();
     });
 
     if (OwnerWeapon)    
         GetWorldTimerManager().SetTimer(ExplosionTimer, ExplosionDelegate, OwnerWeapon->ProjectileConfig.ProjectileLifeTime, false);
     
 }

Here I'm saying: "destroy the projectile after x seconds", where 'x' is the LifeTime value of the Projectile.

The most problematic thing here is that this crash is not consistent. It's difficult to understand what causes that to happen.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question