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"

Segmentation error in FTcpListener on Android without INTERNET permission

When packaging the project for Android, I used the UPL mechanism to remove unnecessary permissions, including network access permission:

 <androidManifestUpdates>
     <removePermission android:name="android.permission.INTERNET" />
     <removePermission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <removePermission android:name="android.permission.ACCESS_WIFI_STATE" />
 </androidManifestUpdates>

The application, which runs fine with that permission, now crashes.

It seems the problem is with FTcpListener, which experiences a segmentation error (please see log).

I did not use FTcpListener in my code, I don't know why it is being executed.

Info: built for API level 19, OpenGL ES2, ATC. Problem observed both when launching from editor and when installing packaged .apk.

 D/UE4     (15555): LogSockets:Warning: Failed to create socket Stream [FTcpListener server]
 F/libc    (15555): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 15645 (FTcpListener)
 I/DEBUG   (20265): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
 I/DEBUG   (20265): Build fingerprint: 'samsung/hltexx/hlte:5.0/LRX21V/N9005XXUGBOK6:user/release-keys'
 I/DEBUG   (20265): Revision: '8'
 I/DEBUG   (20265): ABI: 'arm'
 I/DEBUG   (20265): pid: 15555, tid: 15645, name: FTcpListener  >>> net.adynathos.unreality <<<
 I/DEBUG   (20265): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
 I/DEBUG   (20265):     r0 00000000  r1 00000000  r2 913e1c48  r3 00003d1d
 I/DEBUG   (20265):     r4 93fd28a0  r5 9575bfc0  r6 936fc010  r7 00000000
 I/DEBUG   (20265):     r8 936fc060  r9 936fc0b0  sl 936fc100  fp 913e1d50
 I/DEBUG   (20265):     ip a0f5a15c  sp 913e1c40  lr b6f253f7  pc 9f1d2e10  cpsr 40070010
 I/DEBUG   (20265): 
 I/DEBUG   (20265): backtrace:
 I/DEBUG   (20265):     #00 pc 04d95e10  /data/app/net.adynathos.unreality-1/lib/arm/libUE4.so (FTcpListener::Init()+760)
 I/DEBUG   (20265):     #01 pc 01a4c94c  /data/app/net.adynathos.unreality-1/lib/arm/libUE4.so (FRunnableThreadPThread::Run()+120)
 I/DEBUG   (20265):     #02 pc 019c68a0  /data/app/net.adynathos.unreality-1/lib/arm/libUE4.so (FRunnableThreadPThread::_ThreadProc(void*)+184)
 I/DEBUG   (20265):     #03 pc 000137bb  /system/lib/libc.so (__pthread_start(void*)+30)
 I/DEBUG   (20265):     #04 pc 0001189b  /system/lib/libc.so (__start_thread+6)


Edit: I looked at the possible source of the crash.

The log message Failed to create socket can be seen in SocketSubsystemBSD.cpp and is issued before returning a nullptr socket:

 if (!NewSocket)
 {
     UE_LOG(LogSockets, Warning, TEXT("Failed to create socket %s [%s]"), *SocketType.ToString(), *SocketDescription);
 }
 
 return NewSocket;

The crash is happening in ``FTcpListener::Init``. As I understand it, the FTcpSockerBuilder returns nullptr and then the SetReceiveBufferSize is called on nullptr. Probably checking Socket != nullptr again can fix that.

 if (Socket == nullptr)
 {
     Socket = FTcpSocketBuilder(TEXT("FTcpListener server"))
         .AsReusable()
         .BoundToEndpoint(Endpoint)
         .Listening(8);
     // <- the log message suggests this returns nullptr

     int32 NewSize = 0;
     Socket->SetReceiveBufferSize(2*1024*1024, NewSize); // <- crash here?
 }

I would be grateful for your help.

Product Version: UE 4.14
Tags:
more ▼

asked Dec 12 '16 at 02:57 AM in Bug Reports

avatar image

Adynathos
206 5 8 16

avatar image Samantha Sutton ♦♦ STAFF Dec 15 '16 at 09:50 PM

Adynathos,

Could you please upload your full monitor.bat log where this SIGSEGV Signal 11 error is occurring? Please upload it as a .txt file.

Thank you!

avatar image Adynathos Dec 18 '16 at 12:49 AM

Thank you for looking at the issue.

Here is the log file recorded when the application crashed.

And a minimal project needed to replicate it.

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Adynathos,

Removing network permissions on a build that'll be launched will cause a crash on the Android device. If you're simply packaging it however, it will not require networking connection permissions. If you are packaging using cook on the fly, that'll be another reason why your project is crashing.

Thanks!

more ▼

answered Dec 20 '16 at 10:10 PM

avatar image Adynathos Dec 21 '16 at 11:02 PM

Thank you.

Is there some variable in MyProject.Build.cs or node in UPL through which my build script could distinguish whether it is launching locally or packaging the APK for deployment?

(comments are locked)
10|2000 characters needed characters left

Hi Adynathos,

Wow, your app doesn't require internet access at all. This seems like a tough permission to revoke. Net access is central to many inbuilt features in an app.

There are many settings in an unreal project that need internet access, can you check that the settings that are dependent on internet access has been disabled ? Also there are plugins that are dependent on internet settings.

As far as android is concerned, there are many default files that are copied into an unreal project that need internet access. Check out the pic of my folder which contains many default files. alt text

Check out your intermediate folder and see if you find any files that need internet access.

Your error feels like there is still some feature or setting that is dependent on internet/network access.

Thanks d0d0

more ▼

answered Dec 12 '16 at 08:46 PM

avatar image

d0d0
477 16 8 18

avatar image Adynathos Dec 12 '16 at 10:33 PM

Thank you for your reply.

Even if those features do not work without internet access, the application should never crash with a segmentation error (illegal memory access). The program should write to log something like "Connection failed, feature F will be disabled" but not crash.

My game is single-player so generally the its purpose is to display graphics. No network is needed for that.

Getting a SIGSEGV (most probably due to calling a method on null pointer) is never the correct behaviour, so it needs to be fixed anyway.

This is a situation that took the devs by surprise: usually if there is no internet you can create a socket but it will not connect to anything. Here due to the removed permission the OS refused to create a socket, so it was left null.

(comments are locked)
10|2000 characters needed characters left
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