sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: go
Issue: runtime/pprof: no API to access deep stacktraces with MemProfileRecord and BlockProfileRecord
Labels: NeedsDecision,compiler/runtime

### Go version

go version devel go1.23-b788e91bad Tue Jun 11 18:08:44 2024 +0000 linux/amd64

### Output of `go env` in your module/workspace:

```shell
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/korniltsev/.cache/go-build'
GOENV='/home/korniltsev/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/korniltsev/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/korniltsev/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/korniltsev/github/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/korniltsev/github/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.23-b788e91bad Tue Jun 11 18:08:44 2024 +0000'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/korniltsev/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/korniltsev/github/go/src/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1768278824=/tmp/go-build -gno-record-gcc-switches'
```


### What did you do?

I compare stacks from `runtime.MemProfile` and `runtime/pprof.WriteHeapProfile`

https://go.dev/play/p/7iUI7DdMI3r?v=gotip




### What did you see happen?

I see the `MemprofileRecord` stacks are truncated at 32 depth and pprof stacks has proper deep stacks.


### What did you expect to see?

I expected `MemprofileRecord.Stack()` to return a slice with correct deep stack.
Repository: ollama
Issue: AI Models stop working after few user only messages.
Labels: bug

### What is the issue?

I've tested this with `dolphin-llama3:latest` and `llama-dolphin:latest`. I believe this also might be an issue with other models.

This is less of a Ollama issue, but after supplying the messages field with a few user messages such as:
```js
const history = [
  { role: 'user', content: 'respond' },
  { role: 'user', content: 'a' },
  { role: 'user', content: 'la' },
  { role: 'user', content: 'hi' },
  { role: 'user', content: 'hallo' },
  { role: 'user', content: 'test' }
]
```

I guess it learns to just not speak? It returns just nothing in the content prompts. I was thinking of maybe combining all these into one user content, but then the AI starts speaking as if it were me.

I am sending this to the `/api/chat` endpoint.

### OS

Windows

### GPU

Nvidia

### CPU

AMD

### Ollama version

0.1.43
Repository: storybook
Issue: [Documentation]: Add documentation for manual storybook setup without `npx storybook init`
Labels: documentation,needs triage

### Describe the problem

Currently the `npx storybook init` is broken as reported by the issue #26553 preventing me from adding storybook to my project. 

The documentation for React+Vite only provides manual migration. It only provides the `init` cli command to add storybook to a project.

### Additional context

The issue has been open for 2+ months, so I was assuming there must be a way to setup a new project manually but I could find no documentation out there at all, especially since I wanted to use the latest. 

Maybe it exists but I just couldn't locate it clearly?

The project that I was hoping to add it to: https://github.com/anguspiv/todos-app
Repository: opencv
Issue: Does OpenCV really support FFmpeg 5.0+ on Windows?
Labels: question (invalid tracker),category: videoio,category: 3rdparty

### System Information

// C# user
OpenCV version: 4.5.5
Operating System: Windows 10 Enterprise

### Detailed description

My application uses VideoCapture to open a http video stream for images. And for robustness, I need to test the case when the http video stream is not available sometimes. While testing this case, I found that my program crashed. It is not a stably reproducible bug.
 
![image](https://github.com/opencv/opencv/assets/172362642/32fdae1d-87eb-487e-a9c6-39ab62d4c5ac)
![image](https://github.com/opencv/opencv/assets/172362642/877b7b72-320a-42cc-a48c-105253202f51)

After debugging and investigation, I found that this issue was introduced in FFmpeg 4.3 and fixed in FFmpeg 5.0.

So, I tried to downgrade the OpenCV version to 4.4.0 which is with FFmpeg 4.2.3 and it works well. It will log invalid stream index but won't crash.

However, according to the change log of OpenCV, OpenCV supports FFmpeg 5.0+ since version 4.6.0. But that's not what I tested. It seemed that even OpenCV 4.9.0 is still with FFmpeg 4.4.

I don’t know exactly how OpenCV integrates with FFmpeg. I cannot tell which version of FFmpeg is integrated from below file: 
[opencv/3rdparty/ffmpeg/ffmpeg.cmake at 4.9.0 · opencv/opencv (github.com)](https://github.com/opencv/opencv/blob/4.9.0/3rdparty/ffmpeg/ffmpeg.cmake)

I just wonder does OpenCV really support FFmpeg 5.0+? If not, which version will it be supported in the future?

### Steps to reproduce

My code like this:
```
var videoCapture = new VideoCapture();
while (!videoCapture.IsOpened()) videoCapture.Open(url);
receivingImgTask.Start();
```

Reproduce Step:
Disconnect the network cable to make the http video stream unavailable and reconnect.
Do above step several times and the application will crash.
It is hard to reproduce sometimes. maybe reproduced 5 times out of 50 reconnections.

### Issue submission checklist

- [X] I report the issue, it's not a question
- [X] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [X] I updated to the latest OpenCV version and the issue is still there
- [X] There is reproducer code and related data files (videos, images, onnx, etc)
Repository: langchain
Issue: ChatGoogleGenerativeAI does not support streaming
Labels: 🤖:bug,🔌: google

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.
- [X] I am sure that this is a bug in LangChain rather than my code.
- [X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

### Example Code



```
llm =  ChatGoogleGenerativeAI(model="gemini-1.5-pro", streaming=True,max_tokens=2524)

default_chain = LLMChain(
                            prompt = DEFAULT_PROMPT, 
                            llm=self.llm,
                            verbose=False
                            )

`default_chain.ainvoke({"input": rephrased_question['text']}, config={"callbacks":[callback]})`




  async def on_llm_new_token(self, token: str, **kwargs: Any) -> None:
        """Rewrite on_llm_new_token to send token to client."""
         await self.send(token)

```


### Error Message and Stack Trace (if applicable)

_No response_

### Description

I have initiated a langchain chain as seen above, where call back is a class with on_llm_new_token
To call the chain i use ainvoke.

If I use Anyscale llm class or VLLMOpenAI the response is streamed correctly, however with google this is not the case.
Is there a bug in my code? Perhaps some other parameter I should pass to ChatGoogleGenerativeAI ot does google not support streaming?

### System Info

langchain                    0.1.0
langchain-community          0.0.11
langchain-core               0.1.9
langchain-google-genai       1.0.1
langchainhub                 0.1.15
langsmith                    0.0.92
Repository: pytorch
Issue: DISABLED test_mixed_mm_bad_cases (__main__.TestPatternMatcher)
Labels: module: rocm,triaged,module: flaky-tests,skipped,module: inductor

Platforms: rocm

This test was disabled because it is failing in CI. See [recent examples](https://hud.pytorch.org/flakytest?name=test_mixed_mm_bad_cases&suite=TestPatternMatcher&limit=100) and the most recent trunk [workflow logs](https://github.com/pytorch/pytorch/runs/26107149296).

Over the past 3 hours, it has been determined flaky in 2 workflow(s) with 2 failures and 2 successes.

**Debugging instructions (after clicking on the recent samples link):**
DO NOT ASSUME THINGS ARE OKAY IF THE CI IS GREEN. We now shield flaky tests from developers so CI will thus be green but it will be harder to parse the logs.
To find relevant log snippets:
1. Click on the workflow logs linked above
2. Click on the Test step of the job so that it is expanded. Otherwise, the grepping will not work.
3. Grep for `test_mixed_mm_bad_cases`
4. There should be several instances run (as flaky tests are rerun in CI) from which you can study the logs.



<details><summary>Sample error message</summary>

```
Traceback (most recent call last):
  File "inductor/test_pattern_matcher.py", line 233, in test_mixed_mm_bad_cases
    self._test_mixed_impl(fn, args, True, True)
  File "inductor/test_pattern_matcher.py", line 184, in _test_mixed_impl
    self.assertEqual("mixed_mm" in code, mixed_mm_expected)
  File "/opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/testing/_internal/common_utils.py", line 3646, in assertEqual
    raise error_metas.pop()[0].to_error(
AssertionError: Booleans mismatch: False is not True

To execute this test, run the following from the base repo dir:
    PYTORCH_TEST_WITH_ROCM=1 python test/inductor/test_pattern_matcher.py -k TestPatternMatcher.test_mixed_mm_bad_cases

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
```

</details>


Test file path: `inductor/test_pattern_matcher.py`

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @dllehr-amd @jataylo @hongxiayang @clee2000 @ezyang @bdhirsh @anijain2305 @chauhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire
Repository: ollama
Issue: support for recurrent gemma
Labels: model request

https://huggingface.co/google/recurrentgemma-2b-it
Support for recurrent gemma
Repository: ollama
Issue: Apple Silicon macs with 8GB or 16GB slow down when loading larger models
Labels: bug

### What is the issue?

Less of the model should be loaded to Metal to avoid causing lag

### OS

macOS

### GPU

_No response_

### CPU

_No response_

### Ollama version

_No response_
Repository: pytorch
Issue: Improve type inference in torchscript
Labels: oncall: jit

### 🚀 The feature, motivation and pitch

Tracing a simple function fails due to lacking type information

```python
import torch

def f(x, i=-1):
    return x[i]

torch.jit.script(f)
```

currently gives the following error

```console
RuntimeError: 
Expected a default value of type Tensor (inferred) on parameter "i".Because "i" was not annotated with an explicit type it is assumed to be type 'Tensor'.:
  File "/tmp/ipykernel_19433/2509838311.py", line 3
def f(x, i=-1):
~~~~~~~~~~~~~~~
    return x[i]
    ~~~~~~~~~~~ <--- HERE

```

The type of `i` can be inferred as `int`, but `torch.jit.script` currently requires explicit type annotation of `i`, or it assumes `Tensor`.
Note that currently one has to rewrite it as follows

```python
import torch

def f(x, i: int = -1):
    return x[i]

torch.jit.script(f)
```

That might seem like a minor workaround, but fact is that I managed to boil down this minimal code snippet after about two hours of debugging of a real model.

### Alternatives

_No response_

### Additional context

_No response_

cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel
Repository: TypeScript
Issue: Nested generic calls don't inherit outer inferences when their return types are intersections containing functions
Labels: Help Wanted,Possible Improvement

### 🔎 Search Terms

generic call inference intersection return type

### 🕗 Version & Regression Information

- This is the behavior in every version I tried

### ⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.6.0-dev.20240611#code/JYOwLgpgTgZghgYwgAgMIHsQ2AcwDwAqAfMgN4CwAUMsgppAB5gBcyBA3FTaAG7oDWEVhWo1kACgasCASlZ9gAE06iaEBhAStJ0mcgC8JBcq7IAvirNUqizQBs4UFDACuIBGGCZaTuJEJE4nRYuKwYIfjEcsjGKjb2js5uHl4gyAC2AJ4AkiB8ggBCUAIQIAHiwMLI6praUmx6hjHoSubRIjQ6DfItJpRmyABkyGCZAA4Q6DDIwHGUCL6Q4h209OosZKtuGwDM5gA0prwlrFm5+RBFJSDLpmoaWhIMjSQrYsgMd2IA9N-IAHoAfi+NAYADo6NswWB0AAxYAaRTiABMMhU7zMh1EZhkWJxc1sCAcTmQrncnm8ZzyJXKlU2NUeXVkBiMvTawlMTOisVMDLquhZzSUljmCwgfggt1EwUYG1IW3ArD2mKO1MEpxyaslb2qDzqLzIII+Rt+AOBqjE4Mh4GhcIRECRqPRYhV2NxVHxVCAA

### 💻 Code

```ts
interface Config<T> {
  context: T;
  invoke: {
    (x: T): void;
    exec: (x: T) => void;
  };
}

declare function create<T>(config: Config<T>): void;

declare function myInvokeBroken<T>(i: { exec: (x: T) => void }): {
  (x: T): void;
} & typeof i;

create({
  context: { count: 3 },
  invoke: myInvokeBroken({
    exec: (x) => {
      x
      // ^?
      x.count.toFixed(2);
    },
  }),
});

declare function myInvoke<T>(i: { exec: (x: T) => void }): {
  (x: T): void;
  exec: (x: T) => void;
};

create({
  context: { count: 3 },
  invoke: myInvoke({
    exec: (x) => {
      x
      // ^?
      x.count.toFixed(2);
    },
  }),
});
```


### 🙁 Actual behavior

`x` doesn't get contextually typed based on the outer inferences in the `myInvokeBroken` example

### 🙂 Expected behavior

I would expect `myInvokeBroken` and `myInvoke` to work here in the same way. Their return types are the same. It's only that `myInvokeBroken` is using an intersection in its return type while `myInvoke` isn't

### Additional information about the issue

_No response_
Repository: pytorch
Issue: Inconsistency `CrossEntropyLoss` vs `BCELoss` regarding logits/probability space
Labels: module: nn,triaged

### 🚀 The feature, motivation and pitch

The loss [`CrossEntropyLoss`](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html#torch.nn.CrossEntropyLoss) expects logits inputs. On the other hand, there exist [`BCELoss`](https://pytorch.org/docs/stable/generated/torch.nn.BCELoss.html#torch.nn.BCELoss) and [`BCEWithLogitsLoss`](https://pytorch.org/docs/stable/generated/torch.nn.BCEWithLogitsLoss.html#torch.nn.BCEWithLogitsLoss). But there is no counterpart to `CrossEntropyLoss` that expects inputs in the probability space.

### Alternatives

I think it would make more sense if `CrossEntropyLoss` expected probability inputs and if a new `CrossEntropyWithLogitsLoss` was introduced. But this would be a dramatic change in the API.

As such, I would propose to introduce an option `with_logits` (that defaults to `True` to keep compatibility) to `CrossEntropyLoss`.

What do you think?

### Additional context

Finally, I ask the following questions:
- Is it possible to easily train a neural net that outputs softmax probabilities and not logits? It seems like since there is no `CrossEntropyLoss` counterpart for probability space, the user is forced to add a extra step  and use `NLLLoss` or write a custom loss.
- Is the fact that `CrossEntropyLoss` doesn't work with probability space due to under/overflow handling in general?

Thanks!

cc @albanD @mruberry @jbschlosser @walterddr @mikaylagawarecki
Repository: node
Issue: NodeJS unconditionally uses AVX512 instructions even if they are disabled
Labels: dependencies

### Version

v22.0.0-pre and above

### Platform

Linux ZenTower 6.8.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

### Subsystem

base64

### What steps will reproduce the bug?

On a linux machine which supports the AVX-512 extension, disable it, then run `./out/Release/cctest` 

I have reproduced this on an AMD Ryzen Threadripper PRO 7975WX. For compatibility with https://pernos.co/, I've explicitly disabled AVX-512 by adding `clearcpuid=304` to `GRUB_CMDLINE_LINUX_DEFAULT` in `/etc/default/grub`

As you can see, AVX512 isn't listed in the /proc/cpuinfo:

```
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good amd_lbr_v2 nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba perfmon_v2 ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif x2avic v_spec_ctrl vnmi umip pku ospke rdpid overflow_recov succor smca fsrm flush_l1d debug_swap
      bugs		: sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass srso
```

So this CPU feature is not being correctly tested 

### How often does it reproduce? Is there a required condition?

As soon as something uses base64 encode, 100%. 

### What is the expected behavior? Why is that the expected behavior?

Runs correctly

### What do you see instead?

SIGILL: 

```
[----------] 3 tests from Base64Test
[ RUN      ] Base64Test.Encode
Illegal instruction (core dumped)
```

### Additional information

Originally reported as https://github.com/microsoft/vscode/issues/214630, but I have bisected node down to this (f45bb801b69c7105756b971ab076c415d85a9e10) commit: 

```
commit f45bb801b69c7105756b971ab076c415d85a9e10
Author: Node.js GitHub Bot <github-bot@iojs.org>
Date:   Wed Nov 8 19:48:51 2023 +0000

    deps: update base64 to 0.5.1
    
    PR-URL: https://github.com/nodejs/node/pull/50629
    Fixes: https://github.com/nodejs/node/issues/50561
    Fixes: https://github.com/nodejs/node/pull/45091
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    Reviewed-By: Richard Lau <rlau@redhat.com>
```
Repository: vscode
Issue: Lecagy Linux server used in WSL under Ubuntu 22.04
Labels: bug,remote,confirmation-pending,electron-29-update

Version: 1.91.0-insider (user setup)
Commit: 51d598183ea632c658c34e0a11da5706192a1b69
Date: 2024-06-12T05:49:43.246Z
Electron: 29.4.0
ElectronBuildId: 9593362
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22635

WSL
```
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy
```


When installing the server:

```
Updating VS Code Server to version 51d598183ea632c658c34e0a11da5706192a1b69
Removing previous installation...
Installing VS Code Server for Linux legacy-x64 (51d598183ea632c658c34e0a11da5706192a1b69)
```
Repository: neovim
Issue: send alt-x keycodes to vim.fn.chansend()
Labels: enhancement,terminal

### Problem

I've been tinkering around with nested neovim instances and sending pre-recorded keystrokes to them with `vim.fn.feedkeys`. In order to allow me to send these keys without having to have the nested sessions open in a terminal as my current window, I've been trying to transition my code to use `vim.fn.chansend` instead. But it doesn't seem to have the same effect when sending alt-modified keycodes.

### Steps to reproduce

Execute the following script, "hello" is not printed as expected:
```lua
map = "<A-x>"
job_id = vim.fn.termopen("nvim --cmd 'map " .. map .. " :echo \"hello\"<CR>'")
vim.defer_fn(function()
  vim.fn.chansend(job_id, vim.api.nvim_replace_termcodes(map, true, true, true))
end, 500)
```

### Expected behavior

The mapping in the nested instance should execute and "hello" should be printed, as it does when we use `feedkeys`:
```lua
map = "<A-x>"
vim.fn.termopen("nvim --cmd 'map " .. map .. " :echo \"hello\"<CR>'")
vim.defer_fn(function()
  vim.fn.feedkeys("i" .. vim.api.nvim_replace_termcodes(map, true, true, true))
end, 500)
```
or when we use a different mapping:
```lua
map = "<C-q>"
job_id = vim.fn.termopen("nvim --cmd 'map " .. map .. " :echo \"hello\"<CR>'")
vim.defer_fn(function()
  vim.fn.chansend(job_id, vim.api.nvim_replace_termcodes(map, true, true, true))
end, 500)
```

### Neovim version (nvim -v)

NVIM v0.10.0

### Vim (not Nvim) behaves the same?

N/A

### Operating system/version

Ubuntu 22.04.3

### Terminal name/version

Alacritty 0.13.1

### $TERM environment variable

xterm-256color

### Installation

build from repo
Repository: flutter
Issue: Flutter's semantics search has non-linear code in it that can be super slow
Labels: framework,a: accessibility,P2,team-framework,triaged-framework

When running a large app (DevTools on linux) with `flutter run -d linux` I noticed that the app freezes. When l profiled it via DevTools I noticed it spends a lot of time in the semantics code.

`_drawFrame` -> `_handleDrawFrame` -> ... `RendererBinding.drawFrame` -> ... -> `PipelineOwner.flushSemantics` -> ... -> `SemanticsNode.attach`.

Looking at this code it's pretty clear why it spends so much time in it:

```dart
  @visibleForTesting
  void attach(SemanticsOwner owner) {
   ...
    while (owner._nodes.containsKey(id)) {
      // Ids may repeat if the Flutter has generated > 2^16 ids. We need to keep
      // regenerating the id until we found an id that is not used.
      _id = _generateNewId();
    }
    owner._nodes[id] = this;
    ...
  }

  static const int _maxFrameworkAccessibilityIdentifier = (1<<16) - 1;
  static int _lastIdentifier = 0;
  static int _generateNewId() {
    _lastIdentifier = (_lastIdentifier + 1) % _maxFrameworkAccessibilityIdentifier;
    return _lastIdentifier;
  }

  final Map<int, SemanticsNode> _nodes = <int, SemanticsNode>{};
```

(The thing to notice is: If this is only `@visibleForTesting` then I would assume it's only supposed to be run in `flutter test`  and not with `flutter run` / `flutter build`.)

We can see here that we have only 64k ids available. If many nodes are in the system then the loop will very likely loop for a long time before it finds a free id. If we do this for many nodes we have quadratic behavior - which is very bad.

I think this should use a different data structure that can in O(1) or O(log-n) find a free id.
Repository: godot
Issue: Unexpected scene tile recreation after calling `update_internals()`
Labels: bug,topic:2d

### Tested versions

4.2.2.stable / 4.3.beta1

### System information

Arch Linux

### Issue description

It's documented that scene tiles may not be available when the tilemap is ready, and users can call `update_internals()` to force immediate update.

https://github.com/godotengine/godot/blob/3a11eb98181d8fa0b173a8e45ee22e2a8f23ac55/doc/classes/TileMapLayer.xml#L8-L9

Calling `update_internals()` does force create the scene tiles. But these scene tile instances seem temporary. Another deferred internal update (caused by `TileSetAtlasSource::_update_padded_texture`) will soon destroy these instances after `_ready()`.

This seems like a bug, because scene tile instances are not related to the `TileSetAtlasSource` texture update. They should not be recreated.

### Steps to reproduce

Create a TileMapLayer and draw a scene tile.

Run the MRP. Sample output:

```
Scene tiles are not created when _ready: []
Call update_internals()
Created <Node2D#28823258389>
Now scene tiles are created: [SceneTile:<Node2D#28823258389>]
Now exit _ready
Created <Node2D#29041362196>
In a deferred call: [SceneTile:<Node2D#28823258389>, @Node2D@2:<Node2D#29041362196>]
Destroyed SceneTile:<Node2D#28823258389>
```

### Minimal reproduction project (MRP)

[update-internals.zip](https://github.com/user-attachments/files/15802213/update-internals.zip)