text:
AssertionError: The number of the output should be one after the Tuple unpacked manually

Describe the issue:
Environment: Vs Code

NNI version: 2.10
Training service (local|remote|pai|aml|etc): remote
Client OS: MacOSe
Server OS (for remote mode only): Ubuntu
Python version: 3.9
PyTorch/TensorFlow version: 1.12
Is conda/virtualenv/venv used?: conda
Is running in Docker?: No

Hi, I am trying to prune a face detector. I used the following code:
config_list = [{
    'sparsity' : 0.2,
    'op_types' : ['Conv2d'],
}, {
    'exclude' : True,
    'op_names' : ['loc.0', 'loc.1', 'loc.2', 'loc.3', 'loc.4', 'loc.5',
                  'conf.0', 'conf.1', 'conf.2', 'conf.3', 'conf.4', 'conf.5'
                  ]
}]

from nni.algorithms.compression.v2.pytorch.pruning import L1NormPruner
pruner = L1NormPruner(model, config_list)
_, masks = pruner.compress()

import matplotlib.pyplot as plt

for _, mask in masks.items():
    mask = mask['weight'].detach().cpu().numpy()

But, when I try to use ModeSpeedup using this code:
pruner._unwrap_model()

from nni.compression.pytorch.speedup import ModelSpeedup
#model.eval()
ModelSpeedup(model, torch.rand(1,3,28,28), masks).speedup_model()

I get the following error:
/m2/user/Projects/EXTD_Pytorch-master2/layers/functions/prior_box.py:51: TracerWarning: torch.Tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
  output = torch.Tensor(mean).view(-1, 4)
/m2/user/Projects/EXTD_Pytorch-master2/layers/functions/prior_box.py:51: TracerWarning: Converting a tensor to a Python float might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
  output = torch.Tensor(mean).view(-1, 4)
/m2/user/Projects/EXTD_Pytorch-master2/EXTD_64.py:186: UserWarning: volatile was removed and now has no effect. Use `with torch.no_grad():` instead.
  self.priors = Variable(self.priorbox.forward(), volatile=True)
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
/home/user/anaconda3/envs/gpu/lib/python3.9/site-packages/torch/jit/_trace.py:992: TracerWarning: Output nr 1. of the traced function does not match the corresponding output of the Python function. Detailed error:
Tensor-likes are not close!

Mismatched elements: 160 / 60000 (0.3%)
Greatest absolute difference: 11.968140602111816 at index (0, 1, 2, 4) (up to 1e-05 allowed)
Greatest relative difference: 1.0 at index (0, 1, 0, 0) (up to 1e-05 allowed)
  _check_trace(
[2023-05-16 15:41:01] start to speedup the model
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
zero
[2023-05-16 15:41:02] infer module masks...
[2023-05-16 15:41:02] Update mask for base.0.0
[2023-05-16 15:41:02] Update mask for base.0.1
[2023-05-16 15:41:02] Update mask for base.0.2
[2023-05-16 15:41:02] Update mask for base.1.conv.0
[2023-05-16 15:41:02] Update mask for base.1.conv.1
[2023-05-16 15:41:02] Update mask for base.1.conv.2
[2023-05-16 15:41:02] Update mask for base.1.conv.3
...
[2023-05-16 15:41:03] Update mask for .aten::view.299
[2023-05-16 15:41:03] WARNING: throw some args away when calling the function "view"
[2023-05-16 15:41:03] WARNING: throw some args away when calling the function "view"
[2023-05-16 15:41:03] Update mask for .aten::max.267
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?95197ace-cb34-41e7-9b26-e0d4b265c104) or open in a [text editor](command:workbench.action.openLargeOutput?95197ace-cb34-41e7-9b26-e0d4b265c104). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[9], line 5
      3 from nni.compression.pytorch.speedup import ModelSpeedup
      4 #model.eval()
----> 5 ModelSpeedup(model, torch.rand(1,3,28,28), masks).speedup_model()

File [~/anaconda3/envs/gpu/lib/python3.9/site-packages/nni/compression/pytorch/speedup/compressor.py:546](https://vscode-remote+ssh-002dremote-002b160-002e40-002e53-002e84.vscode-resource.vscode-cdn.net/m2/gkrispanis/Projects/EXTD_Pytorch-master2/~/anaconda3/envs/gpu/lib/python3.9/site-packages/nni/compression/pytorch/speedup/compressor.py:546), in ModelSpeedup.speedup_model(self)
    543 fix_mask_conflict(self.masks, self.bound_model, self.dummy_input)
    545 _logger.info("infer module masks...")
--> 546 self.infer_modules_masks()
    547 _logger.info('resolve the mask conflict')
    549 # load the original stat dict before replace the model

File [~/anaconda3/envs/gpu/lib/python3.9/site-packages/nni/compression/pytorch/speedup/compressor.py:383](https://vscode-remote+ssh-002dremote-002b160-002e40-002e53-002e84.vscode-resource.vscode-cdn.net/m2/gkrispanis/Projects/EXTD_Pytorch-master2/~/anaconda3/envs/gpu/lib/python3.9/site-packages/nni/compression/pytorch/speedup/compressor.py:383), in ModelSpeedup.infer_modules_masks(self)
    381 curnode = visit_queue.get()
    382 # forward mask inference for curnode
--> 383 self.update_direct_sparsity(curnode)
    384 successors = self.torch_graph.find_successors(curnode.unique_name)
    385 for successor in successors:

File [~/anaconda3/envs/gpu/lib/python3.9/site-packages/nni/compression/pytorch/speedup/compressor.py:257](https://vscode-remote+ssh-002dremote-002b160-002e40-002e53-002e84.vscode-resource.vscode-cdn.net/m2/gkrispanis/Projects/EXTD_Pytorch-master2/~/anaconda3/envs/gpu/lib/python3.9/site-packages/nni/compression/pytorch/speedup/compressor.py:257), in ModelSpeedup.update_direct_sparsity(self, node)
    252 _auto_infer.input_debugname = input_debugname
    253 # update the mask tensor and the internal output of the submodules
    254 # after manually unpack the tuple/list of tensors, the number of the outputs
...
    258     node.outputs) == 1, 'The number of the output should be one after the Tuple unpacked manually'
    260 out_debugname = node.outputs[0]
    261 # update the output mask into self.masks

AssertionError: The number of the output should be one after the Tuple unpacked manually

Even though I get this error, the model seems to be pruned. What is this issue ? How does it affect the pruning of the model and is there any way to overcome it ? Thanks in advance

hello @gkrisp98 , seems that the tuple unpacking goes wrong, we have released a new speedup version, you could have a try:
pip install nni=3.0rc1

from nni.compression.pytorch.speedup.v2 import ModelSpeedup

I tried to use speedup.v2 and I got this error:
TypeError                                 Traceback (most recent call last)
[<ipython-input-11-3f9ced178c5c>](https://localhost:8080/#) in <cell line: 5>()
      3 from nni.compression.pytorch.speedup.v2 import ModelSpeedup
      4 model.eval()
----> 5 ModelSpeedup(model, torch.rand(1,3,28,28), masks).speedup_model()

8 frames
[/usr/local/lib/python3.10/dist-packages/nni/compression/pytorch/speedup/v2/model_speedup.py](https://localhost:8080/#) in __init__(self, model, dummy_input, masks_or_file, map_location, batch_dim, batch_size, customized_mask_updaters, customized_replacers, graph_module, garbage_collect_values, logger)
     98         self.dummy_input = _normalize_input(dummy_input)
     99         self.bound_model = model
--> 100         self.graph_module = graph_module if isinstance(graph_module, GraphModule) else concrete_trace(model, self.dummy_input)
    101
    102         super().__init__(self.graph_module, garbage_collect_values)

[/usr/local/lib/python3.10/dist-packages/nni/common/concrete_trace_utils/concrete_tracer.py](https://localhost:8080/#) in concrete_trace(root, concrete_args, use_operator_patch, operator_patch_backlist, forward_function_name, check_args, autowrap_leaf_function, autowrap_leaf_class, leaf_module, fake_middle_class, dce)
   1473     tracer = ConcreteTracer()
   1474
-> 1475     graph = tracer.trace(root,
   1476         autowrap_leaf_function = autowrap_leaf_function,
   1477         autowrap_leaf_class = autowrap_leaf_class,

[/usr/local/lib/python3.10/dist-packages/nni/common/concrete_trace_utils/concrete_tracer.py](https://localhost:8080/#) in trace(self, root, autowrap_modules, autowrap_leaf_function, autowrap_leaf_class, leaf_module, fake_middle_class, concrete_args, use_operator_patch, operator_patch_backlist, forward_function_name)
    984                 with OperatorPatcherContext(self, use_operator_patch, operator_patch_backlist):
    985                     self.create_node('output', 'output',
--> 986                                     (self.create_arg(OperatorPatcherContext.patch_run(fn, *args, *more_args, **kwargs)),),
    987                                     {}, type_expr=fn.__annotations__.get('return', None))
    988         finally:

[/usr/local/lib/python3.10/dist-packages/nni/common/concrete_trace_utils/operator_patcher.py](https://localhost:8080/#) in patch_run(func, *args, **kwargs)
    287         with OperatorPatcherContext.ctx_tracer.do_temp_disable(True, True, True):
    288             new_func = OperatorPatcherContext.ctx_patcher.patch_inner(func)
--> 289         return new_func(*args, **kwargs)

[/content/drive/MyDrive/EXTD_Pytorch-master2/EXTD_64.py](https://localhost:8080/#) in new_func(self, x)
    185         self.priorbox = PriorBox(size, features_maps, cfg)
    186         with torch.no_grad():
--> 187           self.priors = self.priorbox.forward()
    188
    189         loc = torch.cat([o.view(o.size(0), -1) for o in loc], 1)

[/usr/local/lib/python3.10/dist-packages/nni/common/concrete_trace_utils/operator_patcher.py](https://localhost:8080/#) in patch_run(func, *args, **kwargs)
    287         with OperatorPatcherContext.ctx_tracer.do_temp_disable(True, True, True):
    288             new_func = OperatorPatcherContext.ctx_patcher.patch_inner(func)
--> 289         return new_func(*args, **kwargs)

[/content/drive/MyDrive/EXTD_Pytorch-master2/layers/functions/prior_box.py](https://localhost:8080/#) in new_func(self)
     49                 mean += [cx, cy, s_kw, s_kh]
     50
---> 51         output = torch.Tensor(mean).view(-1, 4)
     52         if self.clip:
     53             output.clamp_(max=1, min=0)

[/usr/local/lib/python3.10/dist-packages/nni/common/concrete_trace_utils/operator_patcher.py](https://localhost:8080/#) in patch_run(func, *args, **kwargs)
    287         with OperatorPatcherContext.ctx_tracer.do_temp_disable(True, True, True):
    288             new_func = OperatorPatcherContext.ctx_patcher.patch_inner(func)
--> 289         return new_func(*args, **kwargs)

[/usr/local/lib/python3.10/dist-packages/nni/common/concrete_trace_utils/concrete_proxy.py](https://localhost:8080/#) in __len__(self)
    134         if insts[cur].opcode == self.op_call_ex:
    135             # in executing func(..., *proxy)
--> 136             return _orig_len(self.value)
    137         elif insts[cur].opcode == self.op_tuple_unpack_call:
    138             # in executing func(*..., *proxy)

TypeError: object of type 'float' has no len()


text:
Es0m/add static runtime linking

current main of onnxruntime-extensions depends on msvc runtime (vcruntime)
static linkage is desired to reduce downstream dependency
OCOS_ENABLE_STATIC_LIB is an existing option which only seems to be used for webassembly checks atm
added add_compile_options(/MT$<$CONFIG:Debug:d>) and CMAKE_MSVC_RUNTIME_LIBRARY for static linkage if OCOS_ENABLE_STATIC_LIB is specified

/azp run extensions.ci

/azp run extensions.ci

Can you add a the failed build case that you are fixing in ort-extensions CI pipeline to make sure the static link build won't be broken by any future change?
https://github.com/microsoft/onnxruntime-extensions/blob/1f0c76cefaa9359b9fc74ff4b9ed93214486205a/.pipelines/ci.yml#L260
@snnn , can you review this PR as well?

@es0m, I verified -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$CONFIG:Debug:Debug>" parameter in ort-extensions CI pipeline and fixed the issue in protobuf, it works now:  https://github.com/microsoft/onnxruntime-extensions/pull/472
Is that what you needed?

Hi @wenbingl let me check the output on my end. I believe more needs to be set (pthreads_enable_static, etc.)

source: gharchive/pull-request

repo: microsoft/onnxruntime-extensions

license: mit

license_type: permissive

license_source: bigquery


text:
msopenJdk 11 on CentOS7 causes problems installing operating system openjdk package

The msopenjdk-11 from the packages-microsoft-com-prod yum repository provides java-11-openjdk-devel which causes problems for systems that require the standard java-11-openjdk-devel package layout as msopenjdk installs to different locations.
The partial yum provides listing below illustrates the issue:
>yum provides java-11-openjdk-devel
Loaded plugins: langpacks, priorities
...

1:java-11-openjdk-devel-11.0.19.0.7-1.el7_9.x86_64 : OpenJDK 11 Development Environment
Repo        : updates-openlogic

...
msopenjdk-11-11.0.19-1.x86_64 : OpenJDK Development Kit 11 (JDK) with Hotspot by Microsoft
Repo        : packages-microsoft-com-prod
Matched from:
Provides    : java-11-openjdk-devel

When you do an installation of a package that depends on java-11-openjdk-devel you may get either implementation.

hey @MattCodd2, can you share a test case, perhaps using a container image?

If I understand the problem as stated, it is that the Microsoft Build of OpenJDK satisfies the requirements of java-11-openjdk-devel but it doesn't install the specific tools to the same places as the RedHat OpenJDK 11 package. Is that correct?

Yes, that's the problem.
If you have systems with multiple versions of Java installed then you need to have some way of specifying a particular version is used for a specific application, and the OS build enables this by providing symlinks in /etc/alternatives that point to each version:
$ ls -ld /etc/alternatives/java /etc/alternatives/java_sdk*
lrwxrwxrwx 1 root root 73 May  4 21:10 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.372.b07-1.el8_7.x86_64/jre/bin/java
lrwxrwxrwx 1 root root 60 May  4 21:11 /etc/alternatives/java_sdk -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.372.b07-1.el8_7.x86_64
lrwxrwxrwx 1 root root 60 May  4 21:11 /etc/alternatives/java_sdk_1.8.0 -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.372.b07-1.el8_7.x86_64
lrwxrwxrwx 1 root root 60 May  4 21:11 /etc/alternatives/java_sdk_1.8.0_openjdk -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.372.b07-1.el8_7.x86_64
lrwxrwxrwx 1 root root 55 May  4 21:11 /etc/alternatives/java_sdk_11 -> /usr/lib/jvm/java-11-openjdk-11.0.19.0.7-1.el8_7.x86_64
lrwxrwxrwx 1 root root 55 May  4 21:11 /etc/alternatives/java_sdk_11_openjdk -> /usr/lib/jvm/java-11-openjdk-11.0.19.0.7-1.el8_7.x86_64
lrwxrwxrwx 1 root root 54 May  4 21:11 /etc/alternatives/java_sdk_17 -> /usr/lib/jvm/java-17-openjdk-17.0.7.0.7-1.el8_7.x86_64
lrwxrwxrwx 1 root root 54 May  4 21:11 /etc/alternatives/java_sdk_17_openjdk -> /usr/lib/jvm/java-17-openjdk-17.0.7.0.7-1.el8_7.x86_64
lrwxrwxrwx 1 root root 60 May  4 21:11 /etc/alternatives/java_sdk_openjdk -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.372.b07-1.el8_7.x86_64

The Microsoft package only provides the basic symlink:
ls -ld /etc/alternatives/java /etc/alternatives/java_sdk*
ls: cannot access /etc/alternatives/java_sdk*: No such file or directory
lrwxrwxrwx. 1 root root 34 May 11 23:16 /etc/alternatives/java -> /usr/lib/jvm/msopenjdk-11/bin/java

which means that any code that uses the more specific symlinks to select particular versions fails.
Where the actual packages install to wouldn't be a problem if these links were created

So the issue is that the Microsoft package does not contain the right set of symlinks to work properly with /etc/alternatives ?

Is this issue just observed in CentOS7?
I have VMs for AZ DevOps agent-pool running Ubuntu-20.04, and I am getting an error: "Could not create the Java Virtual Machine".
This is the jdk11 that came with the image:
openjdk version "11.0.19" 2023-04-18 LTS
OpenJDK Runtime Environment Microsoft-7621296 (build 11.0.19+7-LTS)
OpenJDK 64-Bit Server VM Microsoft-7621296 (build 11.0.19+7-LTS, mixed mode)

I tried to install the jdk using the JavaToolInstaller@0 taking the openjdk-11 from a storage:
- task: JavaToolInstaller@0
      inputs:
        versionSpec: '11'
        jdkArchitectureOption: 'x64'
        jdkSourceOption: 'AzureStorage'
        azureResourceManagerEndpoint: 'xxx'
        azureStorageAccountName: 'yyy'
        azureContainerName: 'jdkcontainer'
        azureCommonVirtualFile: 'openjdk-11.0.2_linux-x64_bin.tar.gz'

And still the same error: "Could not create the Java Virtual Machine"

The package openjdk-11.0.2_linux-x64_bin.tar.gz is certainly not from Microsoft.

The package openjdk-11.0.2_linux-x64_bin.tar.gz is certainly not from Microsoft.

Yes, I ran SonarQubeAnalyze@5 and it failed with the first jdk that came installed with the image. Then I tried force the jdk-11 installation with the JavaToolInstaller and still get the same error: "Could not create the Java Virtual Machine"

So the issue is that the Microsoft package does not contain the right set of symlinks to work properly with /etc/alternatives ?

Partly.  Mainly that it doesn't provide the vendor independent symlinks so you cannot simply refer to java-11-openjdk regardless of which package is providing Java

Can you provide a detailed log of the error you get?

It's not really something that get logged.   After installing OpenJDK 11 the expectation is that java can be accessed using
/etc/alternatives/java_sdk_11/bin/java
or
/usr/lib/jvm/java-11/bin/java
or any of the other symlinks mentioned above.   The symlinks aren't created by the Microsoft openjdk package

@MattCodd2 your best option here is to extract the JDK into some folder like /opt/, then configure JAVA_HOME to point to the JDK installation directory, configure the $JAVA_HOME/bin in the PATH environment variable, and ensure that no other JDK is installed in the system.
What I described above is what a "manual" configuration looks like.

source: gharchive/issue

repo: microsoft/openjdk

license: MIT

license_source: github-api


text:
Remove label sets

From OT removing labelsets.

Codecov Report

Merging #75 into master will decrease coverage by 0.09%.
The diff coverage is 97.77%.

@@            Coverage Diff             @@
##           master      #75      +/-   ##
==========================================
- Coverage   98.67%   98.57%   -0.10%
==========================================
  Files          14       14
  Lines         753      774      +21
  Branches       97      102       +5
==========================================
+ Hits          743      763      +20
  Misses          8        8
- Partials        2        3       +1

Impacted Files
Coverage Δ

azure_monitor/src/azure_monitor/options.py
100.00% <ø> (ø)

azure_monitor/src/azure_monitor/storage.py
99.31% <94.73%> (-0.69%)
:arrow_down:

...nitor/src/azure_monitor/export/metrics/__init__.py
100.00% <100.00%> (ø)

.../src/azure_monitor/sdk/auto_collection/__init__.py
100.00% <100.00%> (ø)

..._monitor/sdk/auto_collection/dependency_metrics.py
100.00% <100.00%> (ø)

...monitor/sdk/auto_collection/performance_metrics.py
100.00% <100.00%> (ø)

...ure_monitor/sdk/auto_collection/request_metrics.py
100.00% <100.00%> (ø)

azure_monitor/src/azure_monitor/version.py
100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 017f470...d218c19. Read the comment docs.

https://travis-ci.org/github/microsoft/opentelemetry-azure-monitor-python

authors: codecov-io lzchen


text:
How to set up HA for openpai master?

Organization Name: Chaintech

Short summary about the issue/question:
I want to set up HA for master, but I'm not sure about what to do.
Brief what process you are following:
https://github.com/microsoft/pai/blob/master/docs/pai-management/doc/kubernetes-ha.md

OpenPAI Environment:

OpenPAI version: 0.12.0
Cloud provider or hardware configuration:
OS (e.g. from /etc/os-release): Ubuntu 16.04
Kernel (e.g. uname -a): Linux master 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:48 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Hardware (e.g. core number, memory size, storage size, GPU type etc.):
core number: 12 , memory size: 49G, storage size: 256G, no GPU on master node
Others:

For k8s high availability, you can refer to this doc,
/cc @ydye to help

OK, I got it, thank you very much.

repo: microsoft/pai


text:
Can't install kubespray

Organization Name:

Short summary about the issue/question:
fatal: [openpai-master-01 -> 172.168.3.103]: FAILED! => {"changed": false, "cmd": "/usr/bin/rsync --delay-updates -1.15.11-amd64 /usr/local/bin/kubectl", "msg": "rsync: link_stat \"/tmp/releases/hyperkube-v1.15.11-amd64\" failed: ious errors) (code 23) at main.c(1196) [sender=3.1.2]\n", "rc": 23}
Brief what process you are following:
I am following this #4614 to deploy OpenPAI on a single node (OS: Ubuntu 18.04), I use ansible-playbook -i inventory/pai/hosts.yml cluster.yml --become --become-user=root -e "@inventory/pai/openpai.yml" , and I meet some problems that I did not encounter on the computer with the OS Ubuntu16.04.

Error Log:

 [WARNING]:  * Failed to parse /home/xxx/kubespray/inventory/pai/hosts.yml with yaml plugin: 'NoneType' object is not iterable

 [WARNING]:  * Failed to parse /home/xxx/kubespray/inventory/pai/hosts.yml with ini plugin: /home/xxx/kubespray/inventory/pai/hosts.yml:4: Expected key=value host variable assignment, got: 172.168.3.103

 [WARNING]:  * Failed to parse /home/xxx/kubespray/inventory/pai/hosts.yml with auto plugin: no root 'plugin' key found, '/home/xxx/kubespray/inventory/pai/hosts.yml' is not a valid YAML inventory plugin
config file

 [WARNING]: Unable to parse /home/xxx/kubespray/inventory/pai/hosts.yml as an inventory source

 [WARNING]: No inventory was parsed, only implicit localhost is available

PLAY [localhost] *********************************************************************************************************************************************************************************************

TASK [Check ansible version >=2.7.8] *************************************************************************************************************************************************************************
Thursday 22 October 2020  15:57:39 +0800 (0:00:00.060)       0:00:00.060 ******
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}
 [WARNING]: Could not match supplied host pattern, ignoring: bastion

PLAY [bastion[0]] ********************************************************************************************************************************************************************************************
skipping: no hosts matched
 [WARNING]: Could not match supplied host pattern, ignoring: k8s-cluster

 [WARNING]: Could not match supplied host pattern, ignoring: etcd

PLAY [k8s-cluster:etcd] **************************************************************************************************************************************************************************************
skipping: no hosts matched

PLAY [k8s-cluster:etcd] **************************************************************************************************************************************************************************************
skipping: no hosts matched

PLAY [etcd] **************************************************************************************************************************************************************************************************
skipping: no hosts matched

PLAY [k8s-cluster] *******************************************************************************************************************************************************************************************
skipping: no hosts matched

PLAY [k8s-cluster] *******************************************************************************************************************************************************************************************
skipping: no hosts matched

PLAY [kube-master] *******************************************************************************************************************************************************************************************

TASK [download : prep_download | Set a few facts] ************************************************************************************************************************************************************
Thursday 22 October 2020  15:57:39 +0800 (0:00:00.128)       0:00:00.189 ******

TASK [download : Set image info command for containerd] ******************************************************************************************************************************************************
Thursday 22 October 2020  15:57:39 +0800 (0:00:00.059)       0:00:00.248 ******

TASK [download : Register docker images info] ****************************************************************************************************************************************************************
Thursday 22 October 2020  15:57:39 +0800 (0:00:00.059)       0:00:00.307 ******

TASK [download : prep_download | Create staging directory on remote node] ************************************************************************************************************************************
Thursday 22 October 2020  15:57:39 +0800 (0:00:00.060)       0:00:00.367 ******

TASK [download : prep_download | Create local cache for files and images] ************************************************************************************************************************************
Thursday 22 October 2020  15:57:39 +0800 (0:00:00.060)       0:00:00.427 ******

TASK [download : prep_download | On localhost, check if passwordless root is possible] ***********************************************************************************************************************
Thursday 22 October 2020  15:57:39 +0800 (0:00:00.064)       0:00:00.492 ******

TASK [download : prep_download | On localhost, check if user has access to docker without using sudo] ********************************************************************************************************
Thursday 22 October 2020  15:57:39 +0800 (0:00:00.059)       0:00:00.552 ******

TASK [download : prep_download | Parse the outputs of the previous commands] *********************************************************************************************************************************
Thursday 22 October 2020  15:57:40 +0800 (0:00:00.060)       0:00:00.613 ******

TASK [download : prep_download | Check that local user is in group or can become root] ***********************************************************************************************************************
Thursday 22 October 2020  15:57:40 +0800 (0:00:00.057)       0:00:00.670 ******

TASK [download : Use cri-o for cri connection] ***************************************************************************************************************************************************************
Thursday 22 October 2020  15:57:40 +0800 (0:00:00.058)       0:00:00.729 ******

TASK [download : Use containerd for cri connetion] ***********************************************************************************************************************************************************
Thursday 22 October 2020  15:57:40 +0800 (0:00:00.057)       0:00:00.786 ******

TASK [download : Use docker for cri connetion] ***************************************************************************************************************************************************************
Thursday 22 October 2020  15:57:40 +0800 (0:00:00.058)       0:00:00.844 ******
ok: [openpai-master-01]

TASK [download : include_tasks] ******************************************************************************************************************************************************************************
Thursday 22 October 2020  15:57:40 +0800 (0:00:00.089)       0:00:00.933 ******

TASK [download : download | Get kubeadm binary and list of required images] **********************************************************************************************************************************
Thursday 22 October 2020  15:57:40 +0800 (0:00:00.059)       0:00:00.993 ******

TASK [download : download | Download files / images] *********************************************************************************************************************************************************
Thursday 22 October 2020  15:57:40 +0800 (0:00:00.058)       0:00:01.051 ******

TASK [download : download | Sync files / images from ansible host to nodes] **********************************************************************************************************************************
Thursday 22 October 2020  15:57:41 +0800 (0:00:00.685)       0:00:01.737 ******

TASK [kubespray-defaults : Configure defaults] ***************************************************************************************************************************************************************
Thursday 22 October 2020  15:57:41 +0800 (0:00:00.608)       0:00:02.345 ******
ok: [openpai-master-01] => {
    "msg": "Check roles/kubespray-defaults/defaults/main.yml"
}

TASK [kubernetes/tokens : Check_tokens | check if the tokens have already been generated on first master] ****************************************************************************************************
Thursday 22 October 2020  15:57:41 +0800 (0:00:00.110)       0:00:02.456 ******

TASK [kubernetes/tokens : Check_tokens | Set default value for 'sync_tokens' and 'gen_tokens' to false] ******************************************************************************************************
Thursday 22 October 2020  15:57:41 +0800 (0:00:00.055)       0:00:02.511 ******

TASK [kubernetes/tokens : Check_tokens | Set 'sync_tokens' and 'gen_tokens' to true] *************************************************************************************************************************
Thursday 22 October 2020  15:57:41 +0800 (0:00:00.055)       0:00:02.566 ******

TASK [kubernetes/tokens : Check tokens | check if a cert already exists] *************************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.056)       0:00:02.622 ******

TASK [kubernetes/tokens : Check_tokens | Set 'sync_tokens' to true] ******************************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.057)       0:00:02.679 ******

TASK [kubernetes/tokens : Make sure the tokens directory exits] **********************************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.058)       0:00:02.738 ******

TASK [kubernetes/tokens : Gen_tokens | copy tokens generation script] ****************************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.093)       0:00:02.831 ******

TASK [kubernetes/tokens : Gen_tokens | generate tokens for master components] ********************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.087)       0:00:02.919 ******

TASK [kubernetes/tokens : Gen_tokens | generate tokens for node components] **********************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.093)       0:00:03.012 ******

TASK [kubernetes/tokens : Gen_tokens | Get list of tokens from first master] *********************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.093)       0:00:03.106 ******

TASK [kubernetes/tokens : Gen_tokens | Gather tokens] ********************************************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.088)       0:00:03.194 ******

TASK [kubernetes/tokens : Gen_tokens | Copy tokens on masters] ***********************************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.060)       0:00:03.255 ******

TASK [kubernetes/master : Pre-upgrade | Delete master manifests if etcd secrets changed] *********************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.057)       0:00:03.312 ******

TASK [kubernetes/master : Pre-upgrade | Delete master containers forcefully] *********************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.083)       0:00:03.396 ******

TASK [kubernetes/master : Make sure the users directory exits] ***********************************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.084)       0:00:03.481 ******

TASK [kubernetes/master : Populate users for basic auth in API] **********************************************************************************************************************************************
Thursday 22 October 2020  15:57:42 +0800 (0:00:00.061)       0:00:03.542 ******

TASK [kubernetes/master : Create webhook token auth config] **************************************************************************************************************************************************
Thursday 22 October 2020  15:57:43 +0800 (0:00:00.066)       0:00:03.609 ******

TASK [kubernetes/master : Check if secret for encrypting data at rest already exist] *************************************************************************************************************************
Thursday 22 October 2020  15:57:43 +0800 (0:00:00.068)       0:00:03.678 ******

TASK [kubernetes/master : Slurp secrets_encryption file if it exists] ****************************************************************************************************************************************
Thursday 22 October 2020  15:57:43 +0800 (0:00:00.063)       0:00:03.741 ******

TASK [kubernetes/master : Base 64 Decode slurped secrets_encryption.yaml file] *******************************************************************************************************************************
Thursday 22 October 2020  15:57:43 +0800 (0:00:00.068)       0:00:03.809 ******

TASK [kubernetes/master : Extract secret value from secrets_encryption.yaml] *********************************************************************************************************************************
Thursday 22 October 2020  15:57:43 +0800 (0:00:00.064)       0:00:03.874 ******

TASK [kubernetes/master : Set kube_encrypt_token across master nodes] ****************************************************************************************************************************************
Thursday 22 October 2020  15:57:43 +0800 (0:00:00.105)       0:00:03.979 ******

TASK [kubernetes/master : Write secrets for encrypting secret data at rest] **********************************************************************************************************************************
Thursday 22 October 2020  15:57:43 +0800 (0:00:00.071)       0:00:04.051 ******

TASK [kubernetes/master : Install | Copy kubectl binary from download dir] ***********************************************************************************************************************************
Thursday 22 October 2020  15:57:43 +0800 (0:00:00.106)       0:00:04.157 ******
fatal: [openpai-master-01 -> xxx.xxx.x.xxx]: FAILED! => {"changed": false, "cmd": "/usr/bin/rsync --delay-updates -F --archive --no-owner --no-group --out-format=<<CHANGED>>%i %n%L /tmp/releases/hyperkube-v1.15.11-amd64 /usr/local/bin/kubectl", "msg": "rsync: link_stat \"/tmp/releases/hyperkube-v1.15.11-amd64\" failed: No such file or directory (2)\nrsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]\n", "rc": 23}

OpenPAI Environment:

OpenPAI version: v1.0.1
Phyical machine
OS (e.g. from /etc/os-release): Ubuntu 18.04.2
Kernel (e.g. uname -a): Linux 4.18.0-15-generic x86_64
Hardware (e.g. core number, memory size, storage size, GPU type etc.): nvidia Tesla M60

There is something wrong with the rsync command:
rsync: link_stat \"/tmp/releases/hyperkube-v1.15.11-amd64\" failed: No such file or directory

Could you please run ls -la /tmp/releases to see whether the file hyperkube-v1.15.11-amd64 is downloaded?

There is something wrong with the rsync command:
rsync: link_stat \"/tmp/releases/hyperkube-v1.15.11-amd64\" failed: No such file or directory

Could you please run ls -la /tmp/releases to see whether the file hyperkube-v1.15.11-amd64 is downloaded?

This file is not downloaded.

So please check the log to find out why hyperkube is not downloaded. Maybe the download task is skipped or failed.

So please check the log to find out why hyperkube is not downloaded. Maybe the download task is skipped or failed.

Thank you, so how can i check the log?

Just look for all information containing hyperkube

I have the same issue.
@hzy46 : Could you be more specific about how to debug this? I don't know which log file you mean.
I was able to solve the above mentioned error message by manually downloading the hyperkube binary from https://storage.googleapis.com/kubernetes-release/release/{{ kube_version }}/bin/linux/amd64/hyperkube, however, I immediately get the next error when calling ansible-playbook again:
Monday 14 December 2020  15:56:52 +0100 (0:00:00.049)       0:00:04.947 *******
fatal: [hostname]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute 'k8s-cluster'"}

@uniwuppes hi uniwuppes, the log I mentioned means the stdout and stderr information printed on screen.
The error you encountered is a bit strange. Have you modified the  kubespray source code or config manually?

@hzy46
Hello, the file "kubeadm-v1.15.11-amd64" indeed exist in my /tmp/release/. However, "msg": "[Errno 2] No such file or directory" still over there, which in ASK [kubernetes/node : install | Copy kubelet binary from download dir]
WARNING: The below traceback may *not* be related to the actual failure.                                                                                [56/1550]
  File "/tmp/ansible_synchronize_payload_TJHtsP/ansible_synchronize_payload.zip/ansible/module_utils/basic.py", line 2592, in run_command
    cmd = subprocess.Popen(args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
fatal: [generalai-v100s-1 -> 172.18.29.14]: FAILED! => {
    "changed": false,
    "cmd": "sshpass",
    "invocation": {
        "module_args": {
            "_local_rsync_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "_local_rsync_path": "rsync",
            "_substitute_controller": false,
            "archive": true,
            "checksum": false,
            "compress": false,
            "copy_links": false,
            "delete": false,
            "dest": "/usr/local/bin/kubelet",
            "dest_port": null,
            "dirs": false,
            "existing_only": false,
            "group": false,
            "link_dest": null,
            "links": null,
            "mode": "push",
            "owner": false,
            "partial": false,
            "perms": true,
            "private_key": null,
            "recursive": null,
            "rsync_opts": [],
            "rsync_path": null,
            "rsync_timeout": 0,
            "set_remote_user": true,
            "src": "/tmp/releases/hyperkube-v1.15.11-amd64",
            "ssh_args": null,
            "times": null,
            "verify_host": false
        }
    },

The reproduce way is use -e to add a new worker node. (all original node works good)

@hzy46
Hello, the file "kubeadm-v1.15.11-amd64" indeed exist in my /tmp/release/. However, "msg": "[Errno 2] No such file or directory" still over there, which in ASK [kubernetes/node : install | Copy kubelet binary from download dir]
WARNING: The below traceback may *not* be related to the actual failure.                                                                                [56/1550]
  File "/tmp/ansible_synchronize_payload_TJHtsP/ansible_synchronize_payload.zip/ansible/module_utils/basic.py", line 2592, in run_command
    cmd = subprocess.Popen(args, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
fatal: [generalai-v100s-1 -> 172.18.29.14]: FAILED! => {
    "changed": false,
    "cmd": "sshpass",
    "invocation": {
        "module_args": {
            "_local_rsync_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "_local_rsync_path": "rsync",
            "_substitute_controller": false,
            "archive": true,
            "checksum": false,
            "compress": false,
            "copy_links": false,
            "delete": false,
            "dest": "/usr/local/bin/kubelet",
            "dest_port": null,
            "dirs": false,
            "existing_only": false,
            "group": false,
            "link_dest": null,
            "links": null,
            "mode": "push",
            "owner": false,
            "partial": false,
            "perms": true,
            "private_key": null,
            "recursive": null,
            "rsync_opts": [],
            "rsync_path": null,
            "rsync_timeout": 0,
            "set_remote_user": true,
            "src": "/tmp/releases/hyperkube-v1.15.11-amd64",
            "ssh_args": null,
            "times": null,
            "verify_host": false
        }
    },

The reproduce way is use -e to add a new worker node. (all original node works good)

authors: ReyRen hzy46 uniwuppes zerozakiihitoshiki


text:
Allow Stream as input (vs filepath)

When doing processing in batch/bulk, it would be more advantageous to allow the user to pass a System.IO.Stream into new ETWTraceEventSource() vs having to download the file to disk and pass the filename in.
We are attempting to do processing in the cloud via an Azure Function and so downloading to disk is blocking this scenario.

This is a fair request, but unfortunately there's no good alternative for ETW files. The root of the problem is that the Win32 API for opening ETW files, OpenTrace takes a file path.
@brianrob and I have explored alternatives. For example, I've heard that there is (or soon will be) a new Windows API we can use, but it probably won't be available in Azure Functions for a while. We're also aware of another team doing custom processing of the ETL file format (so it can be done within a Linux container, for example). That would be fragile and unsupported, so unlikely to make it into this open source project.
I'm in the same boat, BTW. A service I operate processes ETW files (from Azure Blob storage) in Azure Functions too. Contact me internally if you like and we can trade ideas.

This request has come up again, but this time for .netperf/.nettrace files. I believe this is more achievable since EventPipeEventSource has a constructor that takes a Stream.

This request has come up again, but this time for .netperf/.nettrace files. I believe this is more achievable since EventPipeEventSource has a constructor that takes a Stream.

Agreed for EventPipeEventSource, though we'd need to do some due diligence to see if there are any streaming-specific paths and address them, since this constructor expects to have the data live-streamed (e.g. do we disable any features because we're streaming).
cc: @noahfalk, @davmason

e.g. do we disable any features because we're streaming).

As I recall EventPipeEventSource has the same behavior regardless whether the Stream is backed by a file or a stream. One spot that might show a little variation is that either the constructor is going to block until the header is read or some of the properties that return stream info (like the process ID) aren't going to have a value until that header is received. There may also be some perf differences where the file-backed code will read ahead and cache but when stream-backed it avoids doing that.

Thanks @noahfalk.  @pharring it sounds like you might already be able to use the existing EventPipeEventSource constructor that takes a Stream.

authors: brandonh-msft brianrob noahfalk pharring

repo: microsoft/perfview


text:
Fix component governance alerts

Fixes
https://devdiv.visualstudio.com/DevDiv/_componentGovernance/119762/alert/6720712?typeId=795877
https://devdiv.visualstudio.com/DevDiv/_componentGovernance/119762/alert/6651919?typeId=795877

ran npm audix fix in skillmap

Arcade list: https://devdiv.visualstudio.com/DevDiv/_componentGovernance/121300
Microbit list: https://devdiv.visualstudio.com/DevDiv/_componentGovernance/119762

@shakao ?

repo: microsoft/pxt


text:
Does Pylance use django-stubs or django-types for its Django type hints?

There is conflicting information on whether the Pylance extension bundles django-stubs or django-types. Can someone help me understand which Pylance currently uses?
django-types
Most documentation in the last two years points to django-types, such as:

https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#2022931-21-september-2022-prerelease

https://github.com/microsoft/pylance-release/issues/3918#issuecomment-1472117429

I mistakenly fixed this in https://github.com/microsoft/python-type-stubs instead of https://github.com/sbdchd/django-types.

django-stubs
If I use "Go to Definition" (F12) of some imported Django type hints, it shows django-stubs:
import typing

if typing.TYPE_CHECKING:
    from django.db.models.manager import RelatedManager  # <-- use "Go to Definition" in VS Code

We ship django-types which is a fork of django-stubs and is installed to a directory of the same name. For an explanation of why, see https://github.com/microsoft/pylance-release/issues/4562#issuecomment-1615049922.

We ship django-types which is a fork of django-stubs and is installed to a directory of the same name. For an explanation of why, see #4562 (comment).

Thanks for the explanation and link @debonte!

authors: debonte joeriddles

repo: microsoft/pylance-release


text:
Numpy members marked as nonexistent

Environment data

Language Server version: 2020.8.2
OS and version: Windows 10 v2004 build 19041.264
Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.6 x64

Expected behaviour
Correctly access members
Actual behaviour

Code Snippet / Additional information
As screenshot:
inputColumns = ["foo", "bar", "baz"] # real one is ~200 items
dnnDepth = np.random.randint((len(inputColumns) // 25), (len(inputColumns) // 10) + 2) + 1

Duplicate of #150.
Numpy has no stubs, it's not a good idea to run the type checker in higher than the "off" mode. Likely fixed in the next numpy release.

authors: jakebailey tigerhawkvok


text:
Why is no type or autocomplete present in test function despite pytest fixture having  type hint on mouseover

Again searched around for this but didn't see anything that looked like what I'm seeing, but might not be using the right terms.
Using pytest and pytest-mock to write test cases, I have:
import pytest

@pytest.fixture
def test_method_fixture(mocker):
   pass
   #mocker.patch('some.func') or similar goes here

Mousing over mocker (which is a fixture supplied by pytest-mock) in the test case signature shows it to be Generator[MockerFixture, None, None]. which I believe is correct?  But in the test case mocker is regarded as type Any and has no autocomplete.
Would appreciate some help understanding if this is by design, a bug, or if I should take it up with the pytest or pytest-mock folks.
edit-  also discovered that changing this slightly:
import pytest

# removed fixture decorator
def test_method_fixture(mocker):
   pass
   #mocker.patch('some.func') or similar goes here

Then mocker is type Any in the signature and inside the method, as I'd expect without adding a type hint of my own

This is by design.
Pylance is built on an open-sourced, standards-compliant type checker called pyright. By design, pyright has no specialized knowledge of any third-party libraries like pytest. This is a principle we've established for pyright, and it's unlikely that we'd violate it. That would be akin to the typescript compiler having intrinsic knowledge of (and specialized behavior for) specific third-party libraries.
Pylance provides language server features on top of pyright. This includes limited support for completion suggestions within pytest test functions, which explains why you're seeing type information in the hover text for the pytest fixture.
If you want pyright to perform full type checking on your test function, you'll need to supply explicit type annotations for the parameters just like with other functions or methods.

Thanks Erik that helps a lot -- I'm (very, very broadly) familiar with pyright, I think what threw me was the seemingly different behaviors in adjacent parts of the code. But if pylance is able to add features on top of it that makes a lot more sense.

This should actually be working in pylance. Heejae added support for first level fixtures in this issue here:
https://github.com/microsoft/pylance-release/issues/4590

closed as by design, if completion for test parameters doesnt work as expected in pylance please reopen

My apologies for leaving this so long. If I understand #4590  correctly then it seems this should work for me but it doesn't.

Since the type here is a Generator would that break this feature? Or could some other aspect of pytest-mock cause it to not work?

authors: Evan0000000000 KacieKK erictraut rchiodo


text:
Include nltk assets in conda env

It would be great if we could have the deployed conda environment include useful nltk assets downloaded by default.
e.g.
punkt
maxent_treebank_pos_tagger
average_perceptron_tagger
universal_tagset
vader_lexicon
stopwords
maxent_ne_chunker
etc

thanks for logging this. Marking as 'enhancement' as this is under consideration.

This request is likely in the same bucket as enabling download of arbitrary conda and pip packages as well. The mechanism is likely the same - privileged operations to download the packages or data payloads prior to any user code executing in the environment.

Updated. See https://support.microsoft.com/en-us/office/open-source-libraries-and-python-in-excel-c817c897-41db-40a1-b9f3-d5ffe6d1bf3e for details. Thx.

authors: jflam keyur32 ncalm

repo: microsoft/python-in-excel


text:
Fix badges in dark mode

Description
Why
Badges displayed incorrectly in dark mode.
In light mode:

In dark mode:

What
Moves to PlatformColor styles from XAML, which support light/dark mode.
Screenshots

Is it possible to use a color for the background that is different from the background of the app, so we can see the badge shape?

Is possible. Figuring out the specific colors needs some looking through the design guides. I opened a separate issue for this since it's not regressed with this PR: https://github.com/microsoft/react-native-gallery/issues/421

repo: microsoft/react-native-gallery


text:
try to avoid trigger when modifying a md

Description

WIP
Related Issues

Checklist:

[ ] I have followed the contribution guidelines and code style for this project.
[ ] I have added tests covering my contributions.
[ ] I have updated the documentation accordingly.
[ ] This PR is being made to staging branch and not to main branch.

@anargyri @gramhagen I'm trying to test if we can avoid triggering the tests when modifying a md file. I'll be making some tests in staging, bear with me

repo: microsoft/recommenders


text:
[Error Analysis] Left alignment of all interpretML tabs

They are left-aligned. Please refer to the fluent style for the margin between tabs

fixed with PR https://github.com/microsoft/responsible-ai-widgets/pull/342

authors: HyemiSong imatiach-msft

repo: microsoft/responsible-ai-widgets


text:
Query string behaviour with PathPattern transform

I've been trying out the new preview and have been diving into what's possible with the new transforms feature. Essentially I'm trying to reproduce what I currently have using Ocelot but with YARP. I'm seeing some interesting behaviour with the PathPattern transform, that I couldn't find in the documentation. I'm not sure if it's a bug, or just me not understanding the feature, but here goes.
In my development environment I have setup an ASP.NET Core app targeting net5.0 that includes YARP. I also have an ASP.NET Core 3.1 app that serves as my backend service for testing. It has one API at /api/values which echoes the incoming headers back in the response, as well as the value of the path query string parameter.
For my configuration I have the following:
"ReverseProxy": {
    "Routes": [
      {
        "RouteId": "realization",
        "ClusterId": "EchoService",
        "Match": {
          "Methods": [ "GET", "POST" ],
          "Path": "/realization/{**catchall}"
        },
        "Transforms": [
            { "PathSet": "/api/values" }
        ]
      },
      {
          "RouteId": "scheduling",
          "ClusterId": "EchoService",
          "Match": {
            "Methods": [ "GET", "POST" ],
            "Path": "/scheduling/{*path}"
          },
          "Transforms": [
              { "PathPattern": "/api/values" }
          ]
      }
    ],
    "Clusters": {
      "EchoService": {
        "LoadBalancing": {
          "Mode": "Random"
        },
        "Destinations": {
          "backend_destination1": {
            "Address": "https://localhost:5003/"
          }
        }
      }
    }
  },

If I do a request to /realization everything is fine and I get back the headers and no path because there is no path after /realization. But if I do a request to /scheduling/shops/4/2019/52/versions/Actual I see a request to https://localhost:5003/api/values?path=shops/4/2019/52/versions/Actual coming into the EchoService. First of all I wasn't necessarily expecting this since I couldn't find anything in the docs that it actually appends the rest as a query string parameter, although that is a nice feature to have.
However, I don't think it is passing the path correctly, because I believe it should be URL encoded at least. My EchoService currently replies with a 404 because of this I think.
Some details
How many backends are in your application?

[x] 1-2
[ ] 3-5
[ ] 6-10
[ ] 10+

How do you host your application?

[ ] Kubernetes
[ ] Azure App Service
[ ] Azure VMs
[ ] Other Cloud Provider (please include details below)
[x] Other Hosting model (please include details below)

What did you think of YARP?
Great project that I'm following with some great interest.

We're re-using MVC's url template binder, I wasn't expecting unused parameters to be added to the query either. The backing field here is only supposed to represent the path so the ? gets encoded as %3F, which explains why your routing broke.

although that is a nice feature to have.

You want it do that (assuming I fix the encoding)? I'd have expected unused parameters to be dropped.
If we keep them, there's also the question of how these extra query parameters should interact with the existing query string on the request. Should they be appended? Replaced?

Drop the extra parameters. I'd prefer to keep the capabilities here to be simple, and defer to a callback for more complex scenarios.

It would be nice to have the capability of putting things into query parameters yes, but I'd rather do it explicitly rather than having this implicit behaviour. For example, I would expect this to work:
      {
          "RouteId": "scheduling",
          "ClusterId": "EchoService",
          "Match": {
            "Methods": [ "GET", "POST" ],
            "Path": "/scheduling/{*remainder}"
          },
          "Transforms": [
              { "PathPattern": "/api/values?path={remainder}" }
          ]
      }

Interestingly this doesn't work currently. If I do this, the path query parameter is passed to the downstream service, but it doesn't get a value.

Ok, but we'd probably make a query transform a separate rule.

That makes total sense. I might be able to write something up if you're willing to take a PR for this?

@jmezach I have created #269 to fix the initial issue with the path.
I don't think the same template APIs we're using will support query strings. You're welcome to experiment and let us know if you come up with a viable approach.

Closing as fixed. If you work out a way to do something similar for query's let us know.

authors: Tratcher jmezach samsp-msft

repo: microsoft/reverse-proxy


text:
Add telemetry to application insights

What should we add or change to make your life better?
Would be interesting to make integtation with application insights easier, like adding all the telemetry to azure application inghts
Why is this important to you?
Because we can use all of the appliction insights infrastructure to monitor the proxy.

YARP operates as an ASP.NET Core component. What do you need from YARP beyond Application Insights existing ASP.NET Core integration?

The application insights log doens't  show the proxy request
For example, my proxy calls an api to get a valid token for this request, if I open the application insights log, it show the token request, but it doesn't show the proxy request to the destination.
Maybe I did something wrong in the telemetry configuration
            services.AddReverseProxy()
                .LoadFromConfig(Configuration.GetSection("ReverseProxy"));
            services.AddTelemetryListeners();

            services.AddApplicationInsightsTelemetry(Configuration["APPINSIGHTS_CONNECTIONSTRING"]);

@MihaZupan do you think this is because of https://github.com/dotnet/runtime/issues/31261?

Triage: We will need some guidance/docs by @MihaZupan

Thanks, if it doesn't work out of the box, is there something that I can do? some extension would help? I could try to develop something if I had the direction

Is there any update to this? I'd also like to know if there's anything we can do now to light up dependency tracking of proxied requests in AppInsights.

It is actively being worked on in runtime. Relevant issue: https://github.com/dotnet/runtime/issues/50658
If you are blocked, see outgoing dependencies tracking docs on how you could instrument your handler.
AppInsights-specific example Handler.cs (untested)

For me, I'm looking for dependency tracing. I want to be able to go into App Insights in the proxy, and see the proxied requests, see what database calls were made in the backend, etc. We can normally do that with our other App Services, but for some reason the proxy isn't doing this at all.

I believe all distributed tracing needs can be addressed via the DistributedContextPropagator APIs added in 6.0.
I recommend we remove the ActivityContextPropagator from YARP when moving to 6.0 (#1055) as DistributedContextPropagator exposes a superset of functionality and YARP's current default does not match Runtime behavior.
Do we care about enhancing ActivityContextPropagator for < 6.0? Workarounds exist and it would ultimately be deprecated.
Removing the milestone to bring this to attention in next triage.

YARP's current default does not match Runtime behavior.

Is this fixable for 1.0?

Is this fixable for 1.0?

Yes, the default I had in mind specifically was BaggageAndCorrelationContext here
https://github.com/microsoft/reverse-proxy/blob/bbd9dbcd844dfa01a7a3d1a46c0c599d974199c3/src/ReverseProxy/Forwarder/ForwarderHttpClientFactory.cs#L131
Default runtime behavior (at least for now) is closer to ActivityContextHeaders.CorrelationContext.

Triage: Some docs may be still needed -- @MihaZupan to check it out, then close.

Note:
From some manual testing, YARP will have to remove tracing headers from the request in order for the E2E to work well (HttpClient internals will no-op if already present).

It may make sense to be a 1.1 feature to go with .NET 6?

authors: MihaZupan Tratcher brentnewbury-work karelz luizfbicalho samsp-msft


text:
Fork.dev integration broken by upgrade to 2.36

git version 2.36.0.vfs.0.0
This started when v2.36 version was installed - I saw that timing line up on two different machines on different days.
The gui I use, Fork.dev, has stopped working. It stays in this state permanently:

(Expected: It loads information about the repo and displays it in its UI, as it did before v2.36).
This happens 100% of the time on some repositories, and 0% of the time on other repositories.
Looking in Fork.dev logs, I see failures like the following:
?? 2022-04-27 16:03:33.129 Git request failed'status --porcelain -z --untracked-files=all':
fatal: unsafe repository ('X:/Office/src' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory X:/Office/src

I can reproduce this failure from a non-elevated command prompt.
P.S. May have the same cause as this issue.

I've confirmed that following the "git config" command listed (for each affected repo) does work around the problem. But that is just a workaround, a fix is still needed.

Let me be clear that the message you see is not a bug. The fact that that warning is shown is Git working exactly as intended, as Git seems to see some dubious ownership there.
If you wish to see more information about the ownership issue, disable the safe.directory setting temporarily (e.g. via git config --global --edit), then run git status after setting the environment variable GIT_TEST_DEBUG_UNSAFE_DIRECTORIES to true.
It might be possible that Git is overreacting, but it is equally possible (I suspect that it is even more likely) that some fishy process lets your worktree be owned by an unintended user.

It is entirely possible for a feature behaving as intended to nevertheless be an unacceptable regression in user experience. This is especially common with security features.
Was this security check recently added or modified? The correlation with git upgrade, strongly suggests this (but doesn’t entirely rule out your theory either). I will follow your advice, but can’t do it right now.

From: Johannes Schindelin @.>
Sent: Friday, April 29, 2022 7:30:15 AM
To: microsoft/scalar @.>
Cc: Andrew Godfrey @.>; Author @.>
Subject: Re: [microsoft/scalar] Fork.dev integration broken by upgrade to 2.36 (Issue #520)
Let me be clear that the message you see is not a bug. The fact that that warning is shown is Git working exactly as intended, as Git seems to see some dubious ownership there.
If you wish to see more information about the ownership issue, disable the safe.directory setting temporarily (e.g. via git config --global --edit), then run git status after setting the environment variable GIT_TEST_DEBUG_UNSAFE_DIRECTORIES to true.
It might be possible that Git is overreacting, but it is equally possible (I suspect that it is even more likely) that some fishy process lets your worktree be owned by an unintended user.
—
Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fscalar%2Fissues%2F520%23issuecomment-1113392379&data=05|01|agodfrey%40microsoft.com|779c9e5e47b94e8d34ec08da29ecc775|72f988bf86f141af91ab2d7cd011db47|1|0|637868394186780501|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=Eh6iPNZDsSi9F6qcE3uXjb5yxcCad5yVcvUsOUnM8H8%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAVRKNTV22VHRYDPKVUI6TF3VHPW7PANCNFSM5UQTUFNQ&data=05|01|agodfrey%40microsoft.com|779c9e5e47b94e8d34ec08da29ecc775|72f988bf86f141af91ab2d7cd011db47|1|0|637868394186780501|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=ABzpoJ%2Fw1GzOoW5PU8xF%2Be4S9E54Koyef%2Bq8qQP0EB0%3D&reserved=0.
You are receiving this because you authored the thread.Message ID: @.***>

authors: AnotherJob dscho

repo: microsoft/scalar


text:
Possible nullptr access

The following code indicates that on line 184 n_tame could be null but goes on to access it unchecked on line 190.
https://github.com/microsoft/snmalloc/blob/d9bca644260847f3b325f4d0e12f0360ed1c0dac/src/snmalloc/mem/freelist.h#L182-L191

@anakrish thanks for looking at this.  I think in this case it is okay.
I assume you are referring to:
Aal::prefetch(&(n_tame->next_object));

Because of the & and -> this boils down to n_tame + offsetof(next_object). So in this case, we will be sending a prefetch hint to the null page. My understanding is that prefetch should not cause an access violation.

Ah, makes sense.

So UBSan agreed with you that this was undefined behaviour, but the CI wasn't properly blocked on UBSan.  I have ended up changing it in
https://github.com/microsoft/snmalloc/pull/662/commits/d3b284cfcacb03a83dd9c53ce90c6871dd1eb758
as part of #662.

repo: microsoft/snmalloc


text:
Identity columns still causing "Spark Dataframe and SQL Server table have differing numbers of columns"

Hi,
for spark 2.4, connector version 1.0.2 and Azure SQL
I saw that issue #52,  which to my understanding is present in version 1.0.2, is supposed to address issues with "Spark Dataframe and SQL Server table have differing numbers of columns" and I assumed this would work for both computed columns and identity columns which both are populated by sql server rather than by the dataframe. This is not working for me with spark 2.4, connector version 1.0.2 and Azure SQL. I looked at the PR for #52 and I see that the fix reads sys.computed_columns to remove them from the column count. Identity columns are stored in sys.identity_columns however so they are not accounted for. Would another fix be required to support identity columns as well?
Apologies if this is a result of miss-use rather than a missing feature. I just can't find any mention of identity columns anywhere in the readme or online resources so I hit a wall in my troubleshooting.
I tried a variety of options, starting with the basic options mentioned in the readme for appends. After failing with this I tried a couple combinations of the following options:  (the url, user and password are passed in the asql_native_options)
                    df_inserts.write \                     .format("com.microsoft.sqlserver.jdbc.spark") \                     .mode("append") \                     .options(**self.asql_native_options) \                     .option("dbtable", dim_name) \                     .option("keepIdentity", False) \                     .option("schemaCheckEnabled", False) \                     .option("keepNulls", True) \                     .save()
Error received is py4j.protocol.Py4JJavaError: An error occurred while calling o1002.save.
: java.sql.SQLException: Spark Dataframe and SQL Server table have differing numbers of columns.
I've made sure my dataframe has all columns except the identity column present.

@savageawakening The previous fix only supports computed columns. Please try to have identity column in your df. The connector will load the identity column as expected /generatted instead of the values you provided.

Thank you I just tested this work around in my scenario and it did work. Can this issue stay open for a future enhancement? While the workaround is not too onerous. It is not intuitive to have to include the identity column and trust that it will be ignored during the insert.

@savageawakening The previous fix only supports computed columns. Please try to have identity column in your df. The connector will load the identity column as expected /generatted instead of the values you provided.

If I add the identity column in the data frame, I still get this error:
SQLServerException: An explicit value for the identity column in table  can only be specified when a column list is used and IDENTITY_INSERT is ON.
Is there a way to add the column to the df without a value attached? Or is there an additional setting to force ignore the identity?

Also ran into this today. This is a common scenario to have an IDENTITY Primary Key on the table where the value is auto-incremented.

authors: luxu1-ms savageawakening schmidtd-enb syedhassaanahmed

repo: microsoft/sql-spark-connector


text:
The status of UTF-16 vs UTF-8 output

Windows Terminal version (or Windows build number)
Terminal: 1.7.1033.0, Windows: 10.0.19041.928
Other Software
cmd.exe
Steps to reproduce

Set up Unicode (UTF-16) output

fflush(stdout);
_setmode(_fileno(stdout), _O_U16TEXT);
_setmode(_fileno(stdin), _O_U16TEXT);
GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), &mode);
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

Print some surrogate pairs via WriteConsoleW

const wchar_t* str = L"\U0002002C\U0001F495"; // 𠀬💕 - both are encoded in UTF-16 as surrogate pairs
DWORD nwritten;
WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), str, 4, &nwritten, NULL);

Print the same string via any CRT facility (fputws, fwrite, wprintf)
Alternatively, set up UTF-8 output via SetConsoleOutputCP(CP_UTF8)
Print the same codepoints (utf-8 encoded, compile with /utf-8) via WriteConsoleA or any CRT facility

Expected Behavior
2/3. Supplementary Plane characters are correctly displayed in Windows Terminal regardless of printing function used. The behavior of "normal" conhost is consistent between functions.
5. The behavior is the same as UTF-16 / wchar_t one.
Actual Behavior
UTF-16 / Wide output
Windows Terminal
Supplementary Plane characters are displayed correctly by Windows Terminal only if both elements of the surrogate pair are printed by a single WriteConsoleW call. Emitting a surrogate pair by two consecutive WriteConsoleW calls results in REPLACEMENT CHARACTER (U+FFFD) being displayed. CRT functions result in U+FFFD being displayed by Windows Terminal in any scenario I've tested.
When copying, U+FFFD characters get copied.
Redirecting the output to a text file results, however, produces correct/uncorrupted UTF-16 (no BOM) text for all output functions used. Subsequently printing it to Windows Terminal by pwsh -c "get-content -encoding Unicode output.txt" displays the text correctly.
Saving it with the BOM in any capable text editor and subsequently printing to the console via type works as well.
"Normal" conhost
In "normal" conhost printing Supplementary Plane characters via a single WriteConsoleW call results in "wide"  being displayed. However, copying from cmd.exe window produces uncorrupted characters.
The rest of behavior is analogous.
UTF-8 char output
Windows Terminal
Supplementary Plane characters are displayed correctly regardless of function employed.
Redirecting produces UTF-8 encoded files.
"Normal" conhost
The behavior is analogous.
Clarify the status of Unicode beyond UCS-2
What method of outputting Unicode text should be used by newly written software? Why do wide CRT functions (and writing one element of a surrogate pair at a time via WriteConsoleW) result in incorrect Windows Terminal behavior?
Is it expected to be fixed?
What is the internal encoding used by Windows Terminal and "normal" conhost? Which output method would allow an application to avoid conversions being performed by conhost?

What method of outputting Unicode text should be used by newly written software?

The goal is that either WriteConsoleW with UTF-16 text or WriteFile/WriteConsoleA with SetConsoleOutputCP to 65001 (UTF-8) will be the ways that newly written software will succeed.

Why do wide CRT functions (and writing one element of a surrogate pair at a time via WriteConsoleW) result in incorrect Windows Terminal behavior?

The CRT functions often do their own internal conversions before writing to the console. See information on setlocale to explicitly choose a locale before writing with the CRT if the fidelity of byte output is very important to your application.

Is it expected to be fixed?

It what?
The CRT? Probably not for compatibility reasons. You will probably have to always declare your intent to the CRT to distinguish yourself from a classic application that just assumed.
Flaws in Conhost and Terminal that lead to the mishandling of any particular Unicode character or sequence? Yes, hopefully, eventually. We tend to make slow and steady progress over time improving the buffers, renderers, and translators to cover top-requested issues on this tracker.

What is the internal encoding used by Windows Terminal and "normal" conhost?

They store things internally as wchar_t arrays which should fully support UCS-2 and support some amount of UTF-16 characters via surrogate pairs to ensure wide characters like extended Chinese and Emoji graphics can be handled.
The PTY mechanism always submits between the processes as UTF-8. Data is converted back and forth from rest to transit to rest again, but because UTF8/UTF16 is an algorithmic conversion, we believe this is lossless.

Which output method would allow an application to avoid conversions being performed by conhost?

WriteConsoleW into the conhost should not be converted and should be inserted into the buffer as it can manage. However, as we continue to improve the buffer to support things like joiners, flow direction, and other specialities of Unicode... we may be required to interpret the characters and I cannot guarantee that there is a scenario where all characters will never be translated.
For a conhost acting in PTY, something is always translated as the rest buffer is ideally UTF-16 and the PTY communication channel is UTF-8. Though again, algorithmic conversions SHOULD be no problem.

shouldn't setlocale(... ,".utf8") also call SetConsoleCP(CP_UTF8)?

I was always under the impression that wide CRT functions are lossless and do not locale-convert (This is AFAIK true for BMP).

Is it expected to be fixed?

It what?

Conhost as well as Terminal failing to display/output non-BMP characters in the majority of UTF-16 scenarios.
Here is the sample code example
#define _USE_CRT_SECURE_NO_WARNINGS
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#include <iostream>
#include <fcntl.h>
#include <io.h>
#include <cstdio>
#include <tuple>

constexpr auto str_utf16 = L"\U0002002C\U0001F495";
constexpr auto str_utf8 = "\U0002002C\U0001F495";
constexpr auto bmp_utf16 = L"BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος\n";
constexpr auto bmp_utf8 = "BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος\n";

int main(int argc, char** argv)
{
    if (argc == 2)
    {
		switch (argv[1][0])
		{
		case '1': // Single WriteConsoleW
		{
			DWORD nWritten;
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			fflush(stdout);
			std::ignore = _setmode(_fileno(stdout), _O_U16TEXT);
			std::ignore = _setmode(_fileno(stdin), _O_U16TEXT);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			WriteConsoleW(hOut, bmp_utf16, 46, &nWritten, NULL);
			WriteConsoleW(hOut, L"Single WriteConsoleW call: ", 27, &nWritten, NULL);
			WriteConsoleW(hOut, str_utf16, 4, &nWritten, NULL);
			WriteConsoleW(hOut, L"\n", 1, &nWritten, NULL);

			SetConsoleMode(hOut, mode);
			break;
		}
		case '2': // Multiple WriteConsoleW
		{
			DWORD nWritten;
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			fflush(stdout);
			std::ignore = _setmode(_fileno(stdout), _O_U16TEXT);
			std::ignore = _setmode(_fileno(stdin), _O_U16TEXT);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			WriteConsoleW(hOut, bmp_utf16, 46, &nWritten, NULL);
			WriteConsoleW(hOut, L"Multiple WriteConsoleW calls (1st split): ", 42, &nWritten, NULL);
			WriteConsoleW(hOut, str_utf16, 1, &nWritten, NULL);
			WriteConsoleW(hOut, str_utf16 + 1, 3, &nWritten, NULL);
			WriteConsoleW(hOut, L"\n", 1, &nWritten, NULL);

			WriteConsoleW(hOut, L"Multiple WriteConsoleW calls (2nd split): ", 42, &nWritten, NULL);
			WriteConsoleW(hOut, str_utf16, 3, &nWritten, NULL);
			WriteConsoleW(hOut, str_utf16 + 3, 1, &nWritten, NULL);
			WriteConsoleW(hOut, L"\n", 1, &nWritten, NULL);

			SetConsoleMode(hOut, mode);
			break;
		}
		case '3': // Single fwrite
		{
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			fflush(stdout);
			std::ignore = _setmode(_fileno(stdout), _O_U16TEXT);
			std::ignore = _setmode(_fileno(stdin), _O_U16TEXT);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			fwrite(bmp_utf16, 2, 46, stdout);
			fwrite(L"Single fwrite call: ", 2, 20, stdout);
			fwrite(str_utf16, 2, 4, stdout);
			fwrite(L"\n", 2, 1, stdout);

			SetConsoleMode(hOut, mode);
			break;
		}
		case '4': // Multiple fwrite
		{
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			fflush(stdout);
			std::ignore = _setmode(_fileno(stdout), _O_U16TEXT);
			std::ignore = _setmode(_fileno(stdin), _O_U16TEXT);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			wchar_t str1[] = { str_utf16[0], L'\0', str_utf16[1], str_utf16[2], str_utf16[3], L'\0' };
			wchar_t str2[] = { str_utf16[0], str_utf16[1], str_utf16[2], L'\0', str_utf16[3], L'\0' };

			fwrite(bmp_utf16, 2, 46, stdout);
			fwrite(L"Multiple fwrite calls (1st split): ", 2, 35, stdout);
			fwrite(str1, 2, 1, stdout);
			fwrite(str1 + 2, 2, 3, stdout);
			fwrite(L"\n", 2, 1, stdout);

			fwrite(L"Multiple fwrite calls (2nd split): ", 2, 35, stdout);
			fwrite(str2, 2, 3, stdout);
			fwrite(str2 + 4, 2, 1, stdout);
			fwrite(L"\n", 2, 1, stdout);

			SetConsoleMode(hOut, mode);
			break;
		}
		case '5': // Single fputws
		{
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			fflush(stdout);
			std::ignore = _setmode(_fileno(stdout), _O_U16TEXT);
			std::ignore = _setmode(_fileno(stdin), _O_U16TEXT);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			fputws(bmp_utf16, stdout);
			fputws(L"Single fputws call: ", stdout);
			fputws(str_utf16, stdout);
			fputws(L"\n", stdout);

			SetConsoleMode(hOut, mode);
			break;
		}
		case '6': // Multiple fputws
		{
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			fflush(stdout);
			std::ignore = _setmode(_fileno(stdout), _O_U16TEXT);
			std::ignore = _setmode(_fileno(stdin), _O_U16TEXT);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			wchar_t str1[] = { str_utf16[0], L'\0', str_utf16[1], str_utf16[2], str_utf16[3], L'\0' };
			wchar_t str2[] = { str_utf16[0], str_utf16[1], str_utf16[2], L'\0', str_utf16[3], L'\0' };

			fputws(bmp_utf16, stdout);
			fputws(L"Multiple fputws calls (1st split): ", stdout);
			fputws(str1, stdout);
			fputws(str1 + 2, stdout);
			fputws(L"\n", stdout);

			fputws(L"Multiple fputws calls (2nd split): ", stdout);
			fputws(str2, stdout);
			fputws(str2 + 4, stdout);
			fputws(L"\n", stdout);

			SetConsoleMode(hOut, mode);
			break;
		}
		case 'a': // Single WriteConsoleA
		{
			DWORD nWritten;
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			SetConsoleOutputCP(CP_UTF8);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			WriteConsoleA(hOut, bmp_utf8, strlen(bmp_utf8), &nWritten, NULL);
			WriteConsoleA(hOut, "Single WriteConsoleA call: ", 27, &nWritten, NULL);
			WriteConsoleA(hOut, str_utf8, strlen(str_utf8), &nWritten, NULL);
			WriteConsoleA(hOut, L"\n", 1, &nWritten, NULL);

			SetConsoleMode(hOut, mode);
			break;
		}
		case 'b': // Multiple WriteConsoleA
		{
			DWORD nWritten;
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			SetConsoleOutputCP(CP_UTF8);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			WriteConsoleA(hOut, bmp_utf8, 13, &nWritten, NULL);
			WriteConsoleA(hOut, bmp_utf8 + 13, strlen(bmp_utf8) - 13, &nWritten, NULL);
			WriteConsoleA(hOut, "Multiple WriteConsoleA calls (1st split): ", 42, &nWritten, NULL);
			WriteConsoleA(hOut, str_utf8, 1, &nWritten, NULL);
			WriteConsoleA(hOut, str_utf8 + 1, 7, &nWritten, NULL);
			WriteConsoleA(hOut, "\n", 1, &nWritten, NULL);

			WriteConsoleA(hOut, "Multiple WriteConsoleA calls (2nd split): ", 42, &nWritten, NULL);
			WriteConsoleA(hOut, str_utf8, 5, &nWritten, NULL);
			WriteConsoleA(hOut, str_utf8 + 5, 3, &nWritten, NULL);
			WriteConsoleA(hOut, "\n", 1, &nWritten, NULL);

			SetConsoleMode(hOut, mode);
			break;
		}
		case 'c': // Single fwrite
		{
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			SetConsoleOutputCP(CP_UTF8);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			fwrite(bmp_utf8, 1, strlen(bmp_utf8), stdout);
			fwrite("Single fwrite call: ", 1, 20, stdout);
			fwrite(str_utf8, 1, 8, stdout);
			fwrite("\n", 1, 1, stdout);

			SetConsoleMode(hOut, mode);
			break;
		}
		case 'd': // Multiple fwrite
		{
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			SetConsoleOutputCP(CP_UTF8);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			char str1[] = { str_utf8[0], '\0', str_utf8[1], str_utf8[2], str_utf8[3], str_utf8[4], str_utf8[5], str_utf8[6], str_utf8[7], '\0' };
			char str2[] = { str_utf8[0], str_utf8[1], str_utf8[2], str_utf8[3], str_utf8[4], '\0', str_utf8[5], str_utf8[6], str_utf8[7], '\0' };

			fwrite(bmp_utf8, 1, strlen(bmp_utf8), stdout);
			fwrite("Multiple fwrite calls (1st split): ", 1, 35, stdout);
			fwrite(str1, 1, 1, stdout);
			fwrite(str1 + 2, 1, 7, stdout);
			fwrite("\n", 1, 1, stdout);

			fwrite("Multiple fwrite calls (2nd split): ", 1, 35, stdout);
			fwrite(str2, 1, 5, stdout);
			fwrite(str2 + 6, 1, 3, stdout);
			fwrite("\n", 1, 1, stdout);

			SetConsoleMode(hOut, mode);
			break;
		}
		case 'e': // Single fputs
		{
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			SetConsoleOutputCP(CP_UTF8);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			fputs(bmp_utf8, stdout);
			fputs("Single fputs call: ", stdout);
			fputs(str_utf8, stdout);
			fputs("\n", stdout);

			SetConsoleMode(hOut, mode);
			break;
		}
		case 'f': // Multiple fputs
		{
			DWORD mode;
			HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

			SetConsoleOutputCP(CP_UTF8);
			GetConsoleMode(hOut, &mode);
			SetConsoleMode(hOut, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);

			char str1[] = { str_utf8[0], '\0', str_utf8[1], str_utf8[2], str_utf8[3], str_utf8[4], str_utf8[5], str_utf8[6], str_utf8[7], '\0' };
			char str2[] = { str_utf8[0], str_utf8[1], str_utf8[2], str_utf8[3], str_utf8[4], '\0', str_utf8[5], str_utf8[6], str_utf8[7], '\0' };

			fputs(bmp_utf8, stdout);
			fputs("Multiple fputs calls (1st split): ", stdout);
			fputs(str1, stdout);
			fputs(str1 + 2, stdout);
			fputs("\n", stdout);

			fputs("Multiple fputs calls (2nd split): ", stdout);
			fputs(str2, stdout);
			fputs(str2 + 6, stdout);
			fputs("\n", stdout);

			SetConsoleMode(hOut, mode);
			break;
		}
		default:
			break;
		}
    }
}

Terminal output:

Conhost output:

Redirecting to file results in correct output in all scenarios. So it is not CRT functions which corrupt the output, but especially the rendering / screen text buffer part shared between Conhost and Terminal, as behavior is exactly analogous. Copying from Terminal / Conhost window results in � REPLACEMENT CHARACTERs:
>output_test.exe 1
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Single WriteConsoleW call: 𠀬💕
>output_test.exe 2
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Multiple WriteConsoleW calls (1st split): �💕�
Multiple WriteConsoleW calls (2nd split): 𠀬��
>output_test.exe 3
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Single fwrite call: ����
>output_test.exe 4
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Multiple fwrite calls (1st split): ����
Multiple fwrite calls (2nd split): ����
>output_test.exe 5
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Single fputws call: ����
>output_test.exe 6
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Multiple fputws calls (1st split): ����
Multiple fputws calls (2nd split): ����
>output_test.exe a
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Single WriteConsoleA call: 𠀬💕
>output_test.exe b
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Multiple WriteConsoleA calls (1st split): 𠀬💕
Multiple WriteConsoleA calls (2nd split): 𠀬💕
>output_test.exe c
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Single fwrite call: 𠀬💕
>output_test.exe d
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Multiple fwrite calls (1st split): 𠀬💕
Multiple fwrite calls (2nd split): 𠀬💕
>output_test.exe e
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Single fputs call: 𠀬💕
>output_test.exe f
BMP test: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος
Multiple fputs calls (1st split): 𠀬💕
Multiple fputs calls (2nd split): 𠀬💕

The fact that it handles utf-8 correctly suggests me that this issue is wide-interface -specific. It blocks outputting text without detecting surrogate pairs in it, for surrogate pairs split between WriteConsoleW would be corrupted, as well as blocks wide-interface libraries like fmt which use wide-interface CRT facilities for output.

repo: microsoft/terminal


text:
Aliased (sharp) text while ClearType is on!!!

Windows Terminal version (or Windows build number)
1.8.1521.0
Other Software
No response
Steps to reproduce
taking screenshots
Expected Behavior
Microsoft store screenshot:

Actual Behavior
Hi, i have latest versions of terminal and windows 10.
my app shows texts aliased, as you see in this picture:

but i am turned on ClearType in all of my profiles!! compare my terminal picture with Store screenshot...
what's the problem? it's very hard to use terminal like this...

I'm sorry, there must be something up with your screenshot. This looks very antialiased to me.

For comparison, this is what aliased text looks like (no blurry edges):

@DHowett Maybe the issue is grayscale vs subpixel antialiasing🤔

authors: AnuthaDev DHowett Farhankhosravi


text:
Start quake mode on boot

Description of the new feature/enhancement
Add an option to start quake mode on system startup in the background, so it is always available from the get-go. Currently setting Windows Terminal to open on startup just opens an ordinary window of it, something that some people, including myself do not want. To start quake mode, I have to wait until the ordinary window fully loads, then press Win+` and then close the ordinary Terminal window.

Proposed technical implementation details
I would like to be able to have Windows Terminal start in the background on boot, so that it has Quake Mode available and so that it doesn't start a normal window that I do not want. This could potentially be a checkbox as something like "Start in Background " below "Launch on Machine Startup" and be dependent on it so that it's grayed out when the latter is off.

Oh, this appears to be a dupe of #9996

Thanks for finding that! Sorry we took so long to get to it -- it's a good feature request.
/dup #9996

authors: DHowett Devnol


text:
Ctrl underscore sends RET in Emacs and terminal

Windows Terminal version (or Windows build number)
Windows Terminal Version: 1.9.1942.0
Other Software
Bug is seen in Emacs 27.2 too in WSL
 wsl --list -v
 NAME            STATE           VERSION
 * Ubuntu-20.04    Running         2

Steps to reproduce
ctrl underscore got by pressing ctrl and _ (underscore)key sends RET in terminal as well as emacs in WSL. ubuntu 20.04
 $uname -a
 Linux CompName 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64     GNU/Linux

$ showkey -a

Press any keys - Ctrl-D will terminate this program

_        95 0137 0x5f
^M       13 0015 0x0d
^D        4 0004 0x04

Expected Behavior
In Emacs Ctrl + _ is usually mapped to undo. It seems to be mapped to RET in emacs as well as terminal as reported above
Actual Behavior
getting RET passed to terminal and in emacs instead of _ or undo in emacs

What keyboard layout are you using? This is what I am seeing with US-104:

does this help?  And I don't remember changing my keyboard settings for quite some time; this seems to be recent.  Unless, the windows update cycle has changed it, the keyboard layout that is.

@sivaramn it depends how the keys are pressed. For Emacs undo to work first press crtl then shift+underscore. This will execute undo function in emacs inside WSL instance.
Here's a sample screenshot, notice Undo! in the echo area:

And this is the output of showkey:
_        95 0137 0x5f
^_       31 0037 0x1f

First line is ctrl followed by shift+underscore. The 2nd line is crtl+shift+underscore.

@sivaramn it depends how the keys are pressed. For Emacs undo to work first press crtl then shift+underscore. This will execute undo function in emacs inside WSL instance.
First line is ctrl followed by shift+underscore. The 2nd line is crtl+shift+underscore.

Yes, I'm aware of this.  I've been using emacs for quite some time and know to C-S _ .   C-h k calls RET from simple.el for the key chord which was weird.  This seems to be in WSL terminal only as other terminals dont have this issue.

problem seems to go away if I switch to

user1@CompName:~$ showkey -a

Press any keys - Ctrl-D will terminate this program

^_       31 0037 0x1f
^D        4 0004 0x04

Still, wouldn't it be a bug that it works differently when the keyboard is switched?

@sivaramn Emacs has "C+x u" for undo actions. Why not use this key combination instead of "C+S+_" which I find more difficult to type than "C+x u".

@sivaramn Emacs has "C+x u" for undo actions. Why not use this key combination instead of "C+S+_" which I find more difficult to type than "C+x u".

True.  But I work with both Win and Linux OSes, ctrl-X does cut in Win apps;  Ctrl _ works universally without any side effects and unintended results.

Still, wouldn't it be a bug that it works differently when the keyboard is switched?

Yep, that's a real bug alright. There's a little bit of weird handling for a couple ctrl+key combos, ^_ is one of them. I'll toss this on the backlog, thanks for following up!

I get this for Ctrl+Shift+Minus (i.e. CTRL+_)
$ showkey -a

Press any keys - Ctrl-D will terminate this program

^M       13 0015 0x0d

I would also like to see a very quick fix to this issue as I use Ctrl+_ as my Undo in emacs.
I installed my windows from scratch today and don't remember seeing this before, so something changed when I installed everything again.

For those of you that are getting a ^M when your press Ctrl+Shift+Minus, this is because your keyboard driver doesn't have a mapping for that key combination, so the terminal is forced to generate an appropriate mapping itself. The way it does that is by taking the base key (in this case -, which is ASCII 0x2D), and masking off the lower 5 bits. The result of that mask is 0x0D, which is ^M.
The reason it works correctly on a US keyboard (and several others) is because the keyboard itself has a built in mapping for that key combination, so it doesn't rely on the terminal to do the translation.
I've recently been experimenting with a rewrite of the VT keyboard handler which fixes this bug (amongst other things). However, I don't want to promise that it's going to be fixed soon - it's still very much a work in progress.

@j4james do you mean that the US keyboard has a mapping for Shift+Minus or specifically for Ctrl+Shift+Minus.
Indeed I'm on a Finnish keyboard, which is quite different from the US one. On my keyboard Shift+Minus is mapped to produce the underscore, i.e. _, which is 0x5F.

@hvesalai I mean it has a mapping specifically for Ctrl+Shift+Minus. You can see what the mappings are on the Keyboard Layout Info website. Compare the US keyboard layout and the Finnish layout.
On both of them, the minus key is VK_OEM_MINUS (although the position of the key is different). And the US layout has the SHIFT+CONTROL state for that key mapped to ␟ (i.e. 0x1F), while the Finnish keyboard has the CONTROL state alone mapped to ␟. Many keyboard layouts won't have a mapping for that character at all.
What that means is that on your keyboard, Ctrl+Minus should produce the 0x1F character, but don't get too use to that behavior. With my new keyboard implementation that'll stop working, and you'll need to use Ctrl+Shift+Minus, the same as you would on a US keyboard.

@j4james OK, that makes a lot of sense. Indeed when using the Terminal, CTRL+Minus works as an Undo in emacs (after I remove the mapping from Terminal's zoom/scaling).

authors: DHowett elsaco hvesalai j4james sivaramn zadjii-msft


text:
Get Chinese characters ghost in display when use TUI program

Windows Terminal version
1.11.3471.0
Windows build number
10.0.22000.0
Other Software
lf r26
fzf 0.29.0
lazygit 0.32.2
powershell 7
Steps to reproduce
install these console TUI software in windows terminal，and just use them interacting with some files in Chinese characters.
Expected Behavior
display characters normally
Actual Behavior
https://user-images.githubusercontent.com/52651594/153695246-fe916770-2e6c-4730-84b2-d425bc157e31.mp4

To reproduce this:

Install lf (I can give you a prebuilt binary)
Clone https://github.com/forthespada/InterviewGuide
Navigate through the various .md files in that project

This issue occurs in cmd.exe, but doesn't occur in WSL.
This makes me suspect that this is an issue in lf and not in Windows Terminal.

Hey @lfishRhungry can you help clarify? Which part is unexpected? the glyph size, or the fact that the glyphs remain on the screen at all?
These two frames follow one another:

The wrongly sized glyphs in the second image are present in the first image. That makes us think they were supposed to be replaced with whitespace, but instead the buffer got corrupted.
https://github.com/gokcehan/lf/issues/451 seems to imply this should have been fixed in r17?
https://github.com/gokcehan/lf/issues/644 was filed in 2021, which sounds like the same thing. That issue was closed by the OP without giving an answer. I'd recommend following up there.
/dup https://github.com/gokcehan/lf/issues/644

Hi @zadjii-msft I think this issue should be reconsidered
gokcehan/lf#644 is not solved yet.
Enable legacy console does make some effect to eliminate some ghost CJK characters. However there are still some ghost characters on display.
Before:

After:

Simular problems occured in

lf (tcell)
fzf (tcell)
lazygit(gocui->termbox)
lazydocker(gocui->termbox)
These repos use different TUI dependencies, so maybe this problem is not caused by repos listed below.

This makes me suspect that this is an issue occurred when running TUI program coded in Golang in Console_Prompt/PowerShell/Windows_Terminal.

You can open a new issue.
I had change my operation system to linux.😅😅😅Hope to learn more.

May I ask, what is the progress of solving this problem? I have the same problem.

We haven't really investigated more.  We'll make sure to update this thread when there are updates to share. In the meantime, might I recommend the Subscribe button?

That way you'll be notified of any updates to this thread, without needlessly pinging everyone on this thread ☺

I have the same problem, too.

pre-emptively putting into 1.19 to see if Atlas v9000 solved this. I don't think so. I'm still under the impression that this is fundamentally an issue down in tcell. The glyph rendering looks a LOT better in the latest 1.18 builds, but something is absolutely choking on the wide chars.

Looks like the new renderer in 1.18 did end up fixing this after all:

authors: CnTeng SpicyChickenFLY bluepongo lfishRhungry lhecker zadjii-msft


text:
Add option to switch tabs in mru but without separate window

Description of the new feature/enhancement
When configuring the behavior of ctrl-tab, one option seems to be missing:

tab strip order with separate window ✔
tab strip order without separate window ✔
mru with separate window ✔
mru without separate window ❌

4 actually feels very nice. It's the default behavior in sublime text. You could try ctrl-tab in sublime text to get a feeling. The idea is, when people ctrl-tab, their eyes actually focus on the tab content (looking for the content they seek), not on titles in the separate window. In that case the separate window becomes intrusive.

Thanks for the suggestion! This is actually already being tracked by another issue on our repo - please refer to #9390 for more discussion.
/dup #9390

authors: ZYinMD zadjii-msft