termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.29k stars 3.06k forks source link

[Bug]: v2ray full use ram and kill termux #20675

Closed id8547854 closed 4 months ago

id8547854 commented 4 months ago

Problem description

v2ray full use ram and kill termux if enable config settings "transit" ( tunnel tor + shadowsocks )

What steps will reproduce the bug?

Run v2ray on ssh local server other phone, connect on proxy socks Firefox.

https://github.com/termux/termux-packages/assets/170825749/0326a4a9-0995-4592-bf5e-e9e227dcb2f1

What is the expected behavior?

Current work no kill termux.

System information

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=3479
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.dev/apt/termux-main stable main
# root-repo (sources.list.d/root.list)
deb https://packages-cf.termux.dev/apt/termux-root root stable
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
Updatable packages:
hugo/stable 0.128.0 aarch64 [upgradable from: 0.127.0]
termux-tools version:
1.42.4
Android version:
8.1.0
Kernel build information:
Linux localhost 3.18.71-perf-g5c5b6e3 #1 SMP PREEMPT Tue Nov 5 23:37:25 WIB 2019 aarch64 Android
Device manufacturer:
Xiaomi
Device model:
Redmi 5A
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api versionCode:51
com.termux.boot versionCode:7
sylirre commented 4 months ago

Your video doesn't explain that it was killed due to low ram.

id8547854 commented 4 months ago

Your video doesn't explain that it was killed due to low ram.

Simple tunnel needed 500mb+ ram ? No optimization.

sylirre commented 4 months ago

About optimizations ask v2ray developers. We only compile its source code for Android OS target.

sylirre commented 4 months ago

Please provide config.json causing such behavior.

id8547854 commented 4 months ago
{

 "log": {
  "logEnabled": true,
  "loglevel": "warning",
  "access": "/data/data/com.termux/files/usr/share/v2ray/access.log",
  "error": "/data/data/com.termux/files/usr/share/v2ray/error.log"
 },

 "inbounds": [
  {
   "port": 7777,
   "protocol": "socks",
   "sniffing": {
    "enabled": false,
    "destOverride": ["http", "tls"]
   }
  }
 ],

 "outbounds": [
  {

   "protocol": "socks",
   "settings": {
    "servers": [
     {
      "address": "127.0.0.1",
      "port": 9050
     }
    ]
   },

   "proxySettings": {
    "tag": "transit" // The tag here must match the tag as the proxy VPS. The "transit" is set here.
   },

   "protocol": "shadowsocks",
   "settings": {
    "servers": [
     {
      "address": "at1.ssproxy.xyz", // Server address of Shadowsocks
      "method": "chacha20-ietf-poly1305", // Encryption method of Shadowsocks
      "ota": false, // Whether enable OTA, default is false, we don't recommand enable this as decrepted by Shadowsocks
      "password": "ZjU3MmRk", // Password of Shadowsocks
      "port": 8388

     }
    ]
   },

   "tag": "transit"

  }
 ]
}
TomJo2000 commented 4 months ago

ssh-ed25519 [redacted]

You're lucky that's a public key. I'm still gonna redact it for you. (Not that it won't still show up in the edit history of the comment)

sylirre commented 4 months ago

Configuration for both socks and shadowsocks outbounds was defined within the same JSON object, possibly causing internal issue in v2ray program.

Edited your configuration:

{
  "log": {
    "logEnabled": true,
    "loglevel": "warning",
    "access": "/data/data/com.termux/files/usr/share/v2ray/access.log",
    "error": "/data/data/com.termux/files/usr/share/v2ray/error.log"
  },
  "inbounds": [
    {
      "port": 7777,
      "protocol": "socks",
      "sniffing": {
        "enabled": false,
        "destOverride": [
          "http",
          "tls"
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "socks",
      "settings": {
        "servers": [
          {
            "address": "127.0.0.1",
            "port": 9050
          }
        ]
      },
      "proxySettings": {
        "tag": "transit"
      }
    },
    {
      "protocol": "shadowsocks",
      "settings": {
        "servers": [
          {
            "address": "at1.ssproxy.xyz",
            "method": "chacha20-ietf-poly1305",
            "ota": false,
            "password": "ZjU3MmRk",
            "port": 8388
          }
        ]
      },
      "proxySettings": {
        "tag": "transit"
      }
    }
  ]
}

Problem gone, clients can successfully connect over 127.0.0.1:7777 proxy.

See syntax for outbounds object: https://www.v2fly.org/v5/config/outbound.html

Each one must be within own { } block.

I'm closing this for now.

id8547854 commented 4 months ago

Exactly what I wanted tunnel (tor + ss) This works correctly.

 "inbounds": [
  {
   "port": 8888,
   "listen": "0.0.0.0",
   "protocol": "socks",
   "settings": {
    "udp": false
   }
  }
 ],
 "outbounds": [
  {
   "protocol": "shadowsocks",
   "settings": {
    "servers": [
     {
      "address": "at1.ssproxy.xyz",
      "method": "chacha20-ietf-poly1305",
      "password": "MGFjNjM5",
      "port": 8388
     }
    ]
   },
   "proxySettings": {
    "tag": "transit"
   }
  },
  {
   "protocol": "socks",
   "settings": {
    "servers": [
     {
      "address": "127.0.0.1",
      "port": 9050
     }
    ]
   },
   "tag": "transit"
  }
 ]
}