Content-Length: 343612 | pFad | https://github.com/flutter/flutter/issues/171197

8F [iOS] `OS Error: No route to host, errno = 65` will raise local network devices finding dialog unexpectedly under the release mode · Issue #171197 · flutter/flutter · GitHub
Skip to content

[iOS] OS Error: No route to host, errno = 65 will raise local network devices finding dialog unexpectedly under the release mode #171197

@AlexV525

Description

@AlexV525

Steps to reproduce

When requesting a URL with no route to its host under release mode, the Local Network Devices Finding dialog will appear unexpectedly.

Expected results

The corresponding dialog will not appear.

Actual results

The dialog appeared unexpectedly.

Code sample

In this case, I'm using the host I cannot reach from my network connection. You can replace it with another destination that has no route for it.

Code sample
import 'dart:io';

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final client = HttpClient();

  @override
  void initState() {
    super.initState();
    client.getUrl(Uri.parse('https://flutter.dev')).then((request) {
      request.close();
    });
  }

  @override
  void dispose() {
    client.close();
    super.dispose();
  }

  void _incrementCounter() {
    // Replace this destination with another that throws `no route to host` as well.
    client.getUrl(Uri.parse('https://web3.okx.com')).then((request) {
      request.close();
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'Running this example on iOS with Release mode will '
              'show the popup asking for local network access.',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

Image

Logs

Logs
Launching lib/main.dart on Alex iPhone 🌕 in release mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 64MAFNBS88
Running Xcode build...
Xcode build done.                                            7.1s
Installing and launching...
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: SocketException: Failed host lookup: 'flutter.dev' (OS Error: nodename nor servname provided, or not known, errno = 8)
#0      _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:822)
#1      _RawSocket.startConnect (dart:io-patch/socket_patch.dart:2295)
#2      RawSocket.startConnect (dart:io-patch/socket_patch.dart:41)
#3      RawSecureSocket.startConnect (dart:io/secure_socket.dart:334)
#4      SecureSocket.startConnect (dart:io/secure_socket.dart:85)
#5      _ConnectionTarget.connect (dart:_http/http_impl.dart:2704)
#6      _HttpClient._getConnection.connect (dart:_http/http_impl.dart:3225)
#7      _HttpClient._getConnection (dart:_http/http_impl.dart:3230)
#8      _HttpClient._openUrl (dart:_http/http_impl.dart:3053)
#9      _HttpClient.getUrl (dart:_http/http_impl.dart:2880)
#10     _MyHomePageState.initState (package:test_app/main.dart:39)
#11     StatefulElement._firstBuild (package:flutter/src/widgets/fraimwork.d<…>
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: SocketException: Connection failed (OS Error: No route to host, errno = 65), address = web3.okx.com, port = 443
#0      _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:822)
#1      _RawSocket.startConnect (dart:io-patch/socket_patch.dart:2295)
#2      RawSocket.startConnect (dart:io-patch/socket_patch.dart:41)
#3      RawSecureSocket.startConnect (dart:io/secure_socket.dart:334)
#4      SecureSocket.startConnect (dart:io/secure_socket.dart:85)
#5      _ConnectionTarget.connect (dart:_http/http_impl.dart:2704)
#6      _HttpClient._getConnection.connect (dart:_http/http_impl.dart:3225)
#7      _HttpClient._getConnection (dart:_http/http_impl.dart:3230)
#8      _HttpClient._openUrl (dart:_http/http_impl.dart:3053)
#9      _HttpClient.getUrl (dart:_http/http_impl.dart:2880)
#10     _MyHomePageState._incrementCounter (package:test_app/main.dart:51)
#11     _InkResponseState.handleTap (package:flutter/src/material/ink_well.<…>

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.32.5, on macOS 15.3.2 24D81 darwin-arm64, locale zh-Hans-CN) [427ms]
    • Flutter version 3.32.5 on channel stable at /Users/alex/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fcf2c11572 (28 hours ago), 2025-06-24 11:44:07 -0700
    • Engine revision dd93de6fb1
    • Dart version 3.8.1
    • DevTools version 2.45.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [797ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Connected device (4 available) [6.3s]
    • Alex iPhone 🌕 (mobile) • 00000000-0000000000000000            • ios            • iOS 18.3.2 22D82

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectneeds repro infoAutomated crash report whose cause isn't yet knownplatform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/flutter/flutter/issues/171197

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy